我在Android应用程序中包含的每个第三方库项目中都有 NoClassDefFoundError 。
当我使用我的应用程序配置Google Map V2时,我收到以下错误;
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
以及其他应用程序中,我对其他类别的库项目也有同样的错误。
我使用下面的软件配置:
**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**
请帮我解决这个问题。我需要做哪些配置更改?
答案 0 :(得分:1)
您可能需要升级&#34; Build-Tool版本&#34;一些最新的。
答案 1 :(得分:0)
由于GMS库与项目位于同一个工作区,我猜它只是没有链接。
右键单击Eclipse Package Explorer,从左侧列表中选择 Properties ,然后选择 Android 。
点击右侧窗格底部的“添加...”按钮,然后选择google-play-services-lib(或类似内容)将该库添加到列表中。
检查 project.properties 文件(在项目的根文件夹中)。它应该有这样的一行:
android.library.reference.1=../google-play-services-lib
现在尝试清理项目再次构建它。希望它会有所帮助。