0
我的APP的主要活動充當佈局上有很多按鈕的功能選擇器。我添加了另一個功能後出現此錯誤,並且它不應該與主要活動的分離體系結構的其他舊功能相關。在此之前,以下兩項活動運行良好。我錯過了什麼?IllegalStateException:無法執行活動的方法/ InvocationTargetException
Main: IPTV_Wallpaper
RSS: RSSDisplayerMain
Map: HealthMapMain
這裏是logcat的: logcat的一個RSS閱讀器活動
06-23 16:15:00.332: E/AndroidRuntime(3124): FATAL EXCEPTION: main
06-23 16:15:00.332: E/AndroidRuntime(3124): java.lang.IllegalStateException: Could not execute method of the activity
06-23 16:15:00.332: E/AndroidRuntime(3124): at android.view.View$1.onClick(View.java:3597)
06-23 16:15:00.332: E/AndroidRuntime(3124): at android.view.View.performClick(View.java:4202)
06-23 16:15:00.332: E/AndroidRuntime(3124): at android.view.View$PerformClick.run(View.java:17341)
06-23 16:15:00.332: E/AndroidRuntime(3124): at android.os.Handler.handleCallback(Handler.java:725)
06-23 16:15:00.332: E/AndroidRuntime(3124): at android.os.Handler.dispatchMessage(Handler.java:92)
06-23 16:15:00.332: E/AndroidRuntime(3124): at android.os.Looper.loop(Looper.java:137)
06-23 16:15:00.332: E/AndroidRuntime(3124): at android.app.ActivityThread.main(ActivityThread.java:5039)
06-23 16:15:00.332: E/AndroidRuntime(3124): at java.lang.reflect.Method.invokeNative(Native Method)
06-23 16:15:00.332: E/AndroidRuntime(3124): at java.lang.reflect.Method.invoke(Method.java:511)
06-23 16:15:00.332: E/AndroidRuntime(3124): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-23 16:15:00.332: E/AndroidRuntime(3124): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-23 16:15:00.332: E/AndroidRuntime(3124): at dalvik.system.NativeStart.main(Native Method)
06-23 16:15:00.332: E/AndroidRuntime(3124): Caused by: java.lang.reflect.InvocationTargetException
06-23 16:15:00.332: E/AndroidRuntime(3124): at java.lang.reflect.Method.invokeNative(Native Method)
06-23 16:15:00.332: E/AndroidRuntime(3124): at java.lang.reflect.Method.invoke(Method.java:511)
06-23 16:15:00.332: E/AndroidRuntime(3124): at android.view.View$1.onClick(View.java:3592)
06-23 16:15:00.332: E/AndroidRuntime(3124): ... 11 more
06-23 16:15:00.332: E/AndroidRuntime(3124): Caused by: java.lang.NoClassDefFoundError: tw.danny.idcc_hw2.RSSDisplayerMain
06-23 16:15:00.332: E/AndroidRuntime(3124): at tw.danny.iptv_1.IPTV_Wallpaper.NewsReader(IPTV_Wallpaper.java:116)
06-23 16:15:00.332: E/AndroidRuntime(3124): ... 14 more
logcat的一個谷歌地圖API活動
06-23 16:15:49.582: E/dalvikvm(3143): Could not find class 'com.google.android.gms.maps.model.LatLng', referenced from method tw.danny.healthmap.HealthMapMain.<clinit>
06-23 16:15:49.582: E/dalvikvm(3143): Could not find class 'com.google.android.gms.maps.model.MarkerOptions', referenced from method tw.danny.healthmap.HealthMapMain.MarkOnMap
06-23 16:15:49.592: E/AndroidRuntime(3143): FATAL EXCEPTION: main
06-23 16:15:49.592: E/AndroidRuntime(3143): java.lang.ExceptionInInitializerError
06-23 16:15:49.592: E/AndroidRuntime(3143): at java.lang.Class.newInstanceImpl(Native Method)
06-23 16:15:49.592: E/AndroidRuntime(3143): at java.lang.Class.newInstance(Class.java:1319)
06-23 16:15:49.592: E/AndroidRuntime(3143): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
06-23 16:15:49.592: E/AndroidRuntime(3143): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
06-23 16:15:49.592: E/AndroidRuntime(3143): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-23 16:15:49.592: E/AndroidRuntime(3143): at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-23 16:15:49.592: E/AndroidRuntime(3143): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-23 16:15:49.592: E/AndroidRuntime(3143): at android.os.Handler.dispatchMessage(Handler.java:99)
06-23 16:15:49.592: E/AndroidRuntime(3143): at android.os.Looper.loop(Looper.java:137)
06-23 16:15:49.592: E/AndroidRuntime(3143): at android.app.ActivityThread.main(ActivityThread.java:5039)
06-23 16:15:49.592: E/AndroidRuntime(3143): at java.lang.reflect.Method.invokeNative(Native Method)
06-23 16:15:49.592: E/AndroidRuntime(3143): at java.lang.reflect.Method.invoke(Method.java:511)
06-23 16:15:49.592: E/AndroidRuntime(3143): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-23 16:15:49.592: E/AndroidRuntime(3143): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-23 16:15:49.592: E/AndroidRuntime(3143): at dalvik.system.NativeStart.main(Native Method)
06-23 16:15:49.592: E/AndroidRuntime(3143): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.maps.model.LatLng
06-23 16:15:49.592: E/AndroidRuntime(3143): at tw.danny.healthmap.HealthMapMain.<clinit>(HealthMapMain.java:36)
06-23 16:15:49.592: E/AndroidRuntime(3143): ... 15 more
按照你的步驟和「清理」項目。有用。謝謝! – user2174595
更新Android sdk和eclipse後,可能會遇到類似的問題。您需要檢查上面的設置,並確保您使用的庫是否已更新 – user2174595