Reputation: 2256
I've tried to use Location API from google-play-services-lib.
I've set up project according to the developer page
http://developer.android.com/google/play-services/setup.html
After running application it crashes with error. Logcat:
Failed resolving interface 1013 'Lcom/google/android/gms/location/LocationListener;
java.lang.NoClassDefFoundError: com.example.fragments.MyFragment
MyFragment implements LocationListener and GooglePlayServices
interfaces.
I have spent lot of time by googling but no solution found. Can someone help? Thank you.
LOGCAT:
07-22 14:08:15.329: E/AndroidRuntime(13259): FATAL EXCEPTION: main
07-22 14:08:15.329: E/AndroidRuntime(13259): java.lang.NoClassDefFoundError:
com.example.fragments.MyFragment
07-22 14:08:15.329: E/AndroidRuntime(13259): at
com.example.fragments.BaseFragment.getPages(BaseFragment.java:80)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
com.example.fragments.BaseFragment.onCreate(BaseFragment.java:48)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.Fragment.performCreate(Fragment.java:1477)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:893)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1164)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.Activity.performStart(Activity.java:5114)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2153)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread.access$600(ActivityThread.java:141)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.os.Handler.dispatchMessage(Handler.java:99)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.os.Looper.loop(Looper.java:137)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
android.app.ActivityThread.main(ActivityThread.java:5039)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
java.lang.reflect.Method.invokeNative(Native Method)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
java.lang.reflect.Method.invoke(Method.java:511)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-22 14:08:15.329: E/AndroidRuntime(13259): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
07-22 14:08:15.329: E/AndroidRuntime(13259): at dalvik.system.NativeStart.main(Native
Method)
Upvotes: 2
Views: 911
Reputation: 2857
What I have done was to update everything to latest versions and switch to latest Android SDK in the project settings. My starting point was https://github.com/playgameservices/play-games-plugin-for-unity/issues/193
Upvotes: 0
Reputation: 1
I had the same situation, and in my case the problem was that I recently updated to a new android bundle (manually, by downloading the new bundle), but for some reason, I kept the old one on my PC, too. So, I had two different directories "adt-bundle-windows-x86-________" on my PC. Normally, this didn't pose any problems, but apparently, the Google Utils were updated into the older directory, while I was developing my app in the newer directory. This messed up the whole thing.
My solution was to move the older directory "adt-bundle-windows-x86-________" away so that there was only exactly 1 directory "adt-bundle-windows-x86-________" present on the PC. Then I updated everything to a clean state with the SDK Manager. From then on, things worked smoothly.
Upvotes: 0