简体   繁体   中英

Error occurs in third party library included Android project

I got NoClassDefFoundError in every third party library project included in my android application.

When i configure Google Map V2 with my application, I got below error ;

09-07 01:35:09.429: E/AndroidRuntime(2061): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/model/LatLng;
09-07 01:35:09.429: E/AndroidRuntime(2061):     at com.taxsmart.collegeapp.support.GoogleMapActivity.<clinit>(GoogleMapActivity.java:34)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at java.lang.reflect.Constructor.newInstance(Native Method)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at java.lang.Class.newInstance(Class.java:1606)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2226)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at android.app.ActivityThread.access$800(ActivityThread.java:151)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at android.os.Handler.dispatchMessage(Handler.java:102)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at android.os.Looper.loop(Looper.java:135)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at android.app.ActivityThread.main(ActivityThread.java:5254)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at java.lang.reflect.Method.invoke(Native Method)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at java.lang.reflect.Method.invoke(Method.java:372)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
09-07 01:35:09.429: E/AndroidRuntime(2061): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.model.LatLng" on path: DexPathList[[zip file "/data/app/com.taxsmart.collegeapp-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
09-07 01:35:09.429: E/AndroidRuntime(2061):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-07 01:35:09.429: E/AndroidRuntime(2061):     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
09-07 01:35:09.429: E/AndroidRuntime(2061):     ... 15 more
09-07 01:35:09.429: E/AndroidRuntime(2061):     Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.maps.model.LatLng
09-07 01:35:09.429: E/AndroidRuntime(2061):         at java.lang.Class.classForName(Native Method)
09-07 01:35:09.429: E/AndroidRuntime(2061):         at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
09-07 01:35:09.429: E/AndroidRuntime(2061):         at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
09-07 01:35:09.429: E/AndroidRuntime(2061):         at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
09-07 01:35:09.429: E/AndroidRuntime(2061):         ... 16 more
09-07 01:35:09.429: E/AndroidRuntime(2061):     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

and also in other applications too , I got same error for other class of included library project.

I use below sofware configurations:

**Windows 10  64-bit
Eclipse Luna Service Release 2 (4.4.2) - 64-bit
Java SE – jdk-7u79-windows-x64
        jre-7u79-windows-x64
Android:
    Android SDK Tools – 24.3.4
    Android SDK Platform Tools – 23
    Android SDK Build-Tools – 18.0.1
    Google Play Services – Rev. 26**

Please help me to solve this issue. Which configuration changes i needs to do?

您可能需要将“ Build-Tool版本”升级到一些最新版本。

Since GMS library is in in the same workspace as your project, I guess it is just not linked.

Right-click on your in Eclipse Package Explorer, select Properties , then Android from the list on the left.

Click "Add.." button on the bottom of right pane, and select google-play-services-lib (or something similar) to add the library to the list.

Check your project.properties file (in root folder of your project). It should have a line like this:

android.library.reference.1=../google-play-services-lib

Now clean the project an try to build it again. Hopefully, it will help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM