Reputation: 61
I'm trying to build an Titanium Android module that uses Google Play Services as a library. I'm having trouble including the library. Here's what I've tried so far:
Managing Projects from the Command Line - Android Developers
I tried adding
android.library.reference.1=path/to/google/play/services/lib
To my build.properties in my android folder, but to no avail. Ant did not recognize it.
After that, I just tried copying over the .jar file to the android/lib folder, and the res folders into platform/android/res. This caused the module to compile, but when trying to use it, I get this error:
[ERROR] GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
[DEBUG] AndroidRuntime: Shutting down VM
[ERROR] TiApplication: (main) [88,5294] Sending event: exception on thread: main msg:java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$style;; Titanium 3.4.0,2014/09/25 16:42,b54c467
[ERROR] TiApplication: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/R$style;
[ERROR] TiApplication: at com.google.android.gms.wallet.fragment.WalletFragmentStyle.Z(Unknown Source)
[ERROR] TiApplication: at com.google.android.gms.wallet.fragment.WalletFragmentOptions.Z(Unknown Source)
[ERROR] TiApplication: at com.google.android.gms.wallet.fragment.SupportWalletFragment.onCreate(Unknown Source)
[ERROR] TiApplication: at android.support.v4.app.Fragment.performCreate(Fragment.java:1477)
[ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:904)
[ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1115)
[ERROR] TiApplication: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
[ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1478)
[ERROR] TiApplication: at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
[ERROR] TiApplication: at com.*snip*.onStart(InstantBuyActivity.java:104)
[ERROR] TiApplication: at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1220)
[ERROR] TiApplication: at android.app.Activity.performStart(Activity.java:5949)
[ERROR] TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2261)
[ERROR] TiApplication: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
[ERROR] TiApplication: at android.app.ActivityThread.access$800(ActivityThread.java:144)
[ERROR] TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
[ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] TiApplication: at android.os.Looper.loop(Looper.java:135)
[ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5221)
[ERROR] TiApplication: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:372)
[ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
[ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
[ERROR] TiApplication: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$style" on path: DexPathList[[zip file "/data/app/*snip*"],nativeLibraryDirectories=[/data/app/*snip*/lib/arm, /vendor/lib, /system/lib]]
[ERROR] TiApplication: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
[ERROR] TiApplication: at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
[ERROR] TiApplication: at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
[ERROR] TiApplication: ... 23 more
[ERROR] TiApplication: Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.R$style
[ERROR] TiApplication: at java.lang.Class.classForName(Native Method)
[ERROR] TiApplication: at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
[ERROR] TiApplication: at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
[ERROR] TiApplication: at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
[ERROR] TiApplication: ... 24 more
[ERROR] TiApplication: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
All the results on Google I've found point to me not referencing the project correctly, but I can't seem to find a way to include it into the project with ant recognizing it and not giving me a bunch of errors. Has anyone had any success with this?
Upvotes: 1
Views: 666
Reputation: 49
I used Titanium Studio to add the google-play-services.jar to the build path of the project and making sure that I copy the actual file to projector/android/lib otherwise it will complain that its not found.
Upvotes: 1