Hi everyone!
I'm trying to write a module for Android. It's about a customized Location Client for my app. I tested the code previously on a simple native Android app and it works. I moved the code to a KrollModule and there isn't compilation errors and seems it's going to work too but I can't try it.
To write this module, it's required to include into the project Google Play Services library (Done!). This is necessary in order to use LocationServices and GoogleApiClient (LocationClient class is missing and deprecated and it's not included on the latest version of the lib).
The problem appears when I put the module into a Titanium app and I try to run it. The library demands to put meta-data on the AndroidManifest but I think Titanium has a problem to link with the lib:
<android xmlns:android="http://schemas.android.com/apk/res/android"> <manifest> ... <application> ... <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> </application> </manifest> </android>I could build both the module and the app without errors, but the app doesn't run. Here is the console log:
Start application log
[INFO] : TiApplication: (main) [0,0] checkpoint, app created.
[WARN] : linker: libstlport_shared.so has text relocations. This is wasting memory and is a security risk. Please fix.
[WARN] : linker: libkroll-v8.so has text relocations. This is wasting memory and is a security risk. Please fix.
[WARN] : linker: libtiverify.so has text relocations. This is wasting memory and is a security risk. Please fix.
[INFO] : TiApplication: (main) [72,341] Titanium Javascript runtime: v8
[INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[WARN] : V8Object: (KrollRuntimeThread) [128,128] Runtime disposed, cannot set property 'userAgent'
[WARN] : dalvikvm: VFY: unable to resolve static field 3268 (common_google_play_services_install_title) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3263 (common_google_play_services_enable_title) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3282 (common_google_play_services_update_title) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3260 (common_android_wear_update_title) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3279 (common_google_play_services_unsupported_title) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3273 (common_google_play_services_network_error_title) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3270 (common_google_play_services_invalid_account_title) in Lcom/google/android/gms/R$string;
[INFO] : I/dalvikvm-heap: Grow heap (frag case) to 12.365MB for 2731536-byte allocation
[WARN] : dalvikvm: VFY: unable to resolve static field 3264 (common_google_play_services_error_notification_requested_by_msg) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3277 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3267 (common_google_play_services_install_text_tablet) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3266 (common_google_play_services_install_text_phone) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3262 (common_google_play_services_enable_text) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3281 (common_google_play_services_update_text) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3259 (common_android_wear_update_text) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3278 (common_google_play_services_unsupported_text) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3272 (common_google_play_services_network_error_text) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3269 (common_google_play_services_invalid_account_text) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3265 (common_google_play_services_install_button) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3261 (common_google_play_services_enable_button) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3280 (common_google_play_services_update_button) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3277 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3274 (common_google_play_services_notification_needs_installation_title) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3275 (common_google_play_services_notification_needs_update_title) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3258 (common_android_wear_notification_needs_update_text) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3271 (common_google_play_services_needs_enabling_title) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3278 (common_google_play_services_unsupported_text) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3272 (common_google_play_services_network_error_text) in Lcom/google/android/gms/R$string;
[WARN] : dalvikvm: VFY: unable to resolve static field 3269 (common_google_play_services_invalid_account_text) in Lcom/google/android/gms/R$string;
[INFO] : TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.locationclient.extension.LocationClientAppActivity@41f47ea0
[WARN] : dalvikvm: VFY: unable to resolve static field 3277 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;
[INFO] : dalvikvm: DexOpt: unable to optimize static field ref 0x0cb4 at 0x2e in Lcom/google/android/gms/common/GooglePlayServicesUtil;.a
[INFO] : dalvikvm: DexOpt: unable to optimize static field ref 0x0cb3 at 0x61 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.a
[INFO] : dalvikvm: DexOpt: unable to optimize static field ref 0x0cd3 at 0x63 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.a
[INFO] : dalvikvm: DexOpt: unable to optimize static field ref 0x0ccc at 0x82 in Lcom/google/android/gms/common/GooglePlayServicesUtil;.a
[ERROR] : GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
[INFO] : I/Adreno-EGL: <qeglDrvAPI_eglInitialize:320>: EGL 1.4 QUALCOMM Build: I0404c4692afb8623f95c43aeb6d5e13ed4b30ddbDate: 11/06/13
The Log shows the following error: GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
And I can't understand why Titanium finds the library at the moment of the building but not when the app is running. I read in some post at StackOverFlow forums that the problem may be the app cannot read the resources folder because is not included on the .jar. I try to put the library folder as a dependency but still not working
Things already tested (and doesn't work):
- Change
@integer/google_play_services_versionby the hardcoded and correct value. - Add the library to the project as ".jar" (Properties -> Java Build Path -> Libraries -> Add JAR / Add External JAR)
- Add the library to the project as "other project" (Properties -> Java Build Path -> Projects)
- Add the meta-data tag on
tiApp.xmlortiModule.xml - Use a custom
AndroidManifest.xmlbased on the version generated by the Titanium.
Some information more:
Application type:
- Android
Titanium SDK:
- Node.js
- Node.js Version = 0.10.13
- npm Version = 1.3.2
Titanium CLI
- CLI Version = 3.4.1
Titanium SDK
- SDK Version = 3.5.0.GA
- SDK Path = C:\ProgramData\Application Data\Titanium\mobilesdk\win32\3.5.0.GA
- Target Platform = android
Platform & version:
- Android 4.0 and higher
Device:
- Nexus 4 running Android 4.4.2
Host Operating System:
- Microsoft Windows 8.1 Pro (32bit)
Titanium Studio:
- Titanium Studio, build: 3.4.1.201410281727
- Build: jenkins-titanium-rcp-master-202 (origin/master)
Someone have an idea what is happening? It's a bug? It's a fail of mine? I'm breaking the head with this problem! It could be reproduced in any module that needs the Google Play Services lib.