2013-10-24 62 views
1

我在前一臺機器上設置了環境,而且我在不同的MacBook上。出於某種奇怪的原因,我一直在遇到我的課程中有一個問題,其中的一個課程發生了FragmentActivity。它口口聲聲說不能找到FragmentActivity類,雖然我有支持jar在類路徑中,按圖像:無法解析FragmentActivity的超類

enter image description here

是我看到詳細的錯誤信息是在這裏:

10-23 23:10:16.300 26062-26062/com.testapp W/dalvikvm﹕ Unable to resolve superclass of Lcom/testapp/views/loginregistration/LoginView; (92) 
10-23 23:10:16.300 26062-26062/com.testapp W/dalvikvm﹕ Link of class 'Lcom/testapp/views/loginregistration/LoginView;' failed 
10-23 23:10:16.300 26062-26062/com.testapp D/AndroidRuntime﹕ Shutting down VM 
10-23 23:10:16.300 26062-26062/com.testapp W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x414f8700) 
10-23 23:10:16.330 26062-26062/com.testapp E/AndroidRuntime﹕ FATAL EXCEPTION: main 
    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.testapp/com.testapp.views.loginregistration.LoginView}: java.lang.ClassNotFoundException: Didn't find class "com.testapp.views.loginregistration.LoginView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.testapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.testapp-1, /vendor/lib, /system/lib]] 
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137) 
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
      at android.app.ActivityThread.access$600(ActivityThread.java:141) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
      at android.os.Handler.dispatchMessage(Handler.java:99) 
      at android.os.Looper.loop(Looper.java:137) 
      at android.app.ActivityThread.main(ActivityThread.java:5103) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:525) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
      at dalvik.system.NativeStart.main(Native Method) 
    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.testapp.views.loginregistration.LoginView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.testapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.testapp-1, /vendor/lib, /system/lib]] 
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53) 
      at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 
      at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 
      at android.app.Instrumentation.newActivity(Instrumentation.java:1061) 
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128) 
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261) 
      at android.app.ActivityThread.access$600(ActivityThread.java:141) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256) 
      at android.os.Handler.dispatchMessage(Handler.java:99) 
      at android.os.Looper.loop(Looper.java:137) 
      at android.app.ActivityThread.main(ActivityThread.java:5103) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:525) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
      at dalvik.system.NativeStart.main(Native Method) 

是否還有其他我缺少的東西?

回答

2

在您的IDE中(如截圖所示),選中包含缺失類的類路徑條目旁邊的「導出」框。

我有一個類Android Android支持庫的類似問題(無法解析超類的Lcom ... PagerAdapter)。原來,在引用的.classpath庫需要導出:

來源:

<classpathentry 

要:

<classpathentry exported="true" ... 

對於Eclipse用戶,我通過出口的Android私家藏書固定的問題在Java Build Path菜單中。

Checking Android Private Libraries in Eclipse Kepler Java Build Path.