2015-09-07 199 views
1

的NoClassDefFoundError在每一個第三方庫的項目包括在我的Android應用程序。錯誤包括Android項目

當我使用我的應用程序配置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 

也在其他應用程序中,我得到同樣的錯誤,其他類包括的庫項目。

我用下面sofware配置:

**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

是你在同一個工作區 – koutuk

+0

項目和庫是U使用eclipse或Android工作室? –

+0

@KaveeshKanwal我正在使用eclipse – Rohan

回答

1

您可能需要將「Build-Tool版本」升級到最新版本。

0

由於GMS庫與您的項目在同一個工作區中,我猜它只是沒有鏈接。在Eclipse Package Explorer中您

單擊鼠標右鍵,從左邊的列表中選擇屬性,然後的Android

點擊「添加...」按鈕,在右側窗格中的底部,然後選擇谷歌播放服務-LIB(或類似的東西)的庫添加到列表中。

檢查您的project.properties文件(在您的項目的根文件夾中)。它應該有這樣一行:

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

現在清理項目,嘗試再次構建它。希望它會有所幫助。

+0

感謝您的回覆。我做了同樣的事,但沒有用。 – Rohan