1

为此,我尝试将一个 android 项目用于另一个 android 项目

Properties--->Build Path-->Project--->Add(选择项目然后添加)-->Order and Export-->选择项目

但这会产生以下错误:

07-26 11:03:09.878: E/AndroidRuntime(573): FATAL EXCEPTION: main
07-26 11:03:09.878: E/AndroidRuntime(573): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.gps_test_prt/com.example.gps_test_prt.GPS_prt_main}: java.lang.ClassNotFoundException: com.example.gps_test_prt.GPS_prt_main
07-26 11:03:09.878: E/AndroidRuntime(573):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
07-26 11:03:09.878: E/AndroidRuntime(573):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
07-26 11:03:09.878: E/AndroidRuntime(573):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
07-26 11:03:09.878: E/AndroidRuntime(573):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
07-26 11:03:09.878: E/AndroidRuntime(573):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-26 11:03:09.878: E/AndroidRuntime(573):  at android.os.Looper.loop(Looper.java:137)
07-26 11:03:09.878: E/AndroidRuntime(573):  at android.app.ActivityThread.main(ActivityThread.java:4340)
07-26 11:03:09.878: E/AndroidRuntime(573):  at java.lang.reflect.Method.invokeNative(Native Method)
07-26 11:03:09.878: E/AndroidRuntime(573):  at java.lang.reflect.Method.invoke(Method.java:511)
07-26 11:03:09.878: E/AndroidRuntime(573):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-26 11:03:09.878: E/AndroidRuntime(573):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-26 11:03:09.878: E/AndroidRuntime(573):  at dalvik.system.NativeStart.main(Native Method)
07-26 11:03:09.878: E/AndroidRuntime(573): Caused by: java.lang.ClassNotFoundException: com.example.gps_test_prt.GPS_prt_main
07-26 11:03:09.878: E/AndroidRuntime(573):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
07-26 11:03:09.878: E/AndroidRuntime(573):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-26 11:03:09.878: E/AndroidRuntime(573):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-26 11:03:09.878: E/AndroidRuntime(573):  at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
07-26 11:03:09.878: E/AndroidRuntime(573):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
07-26 11:03:09.878: E/AndroidRuntime(573):  ... 11 more

`

请帮忙。

谢谢

4

2 回答 2

0

看来您的课程无法实例化。这可能是:

  1. 可见性不是公开的,或者没有公开的构造函数
  2. Activity 未在您使用的应用程序的清单中声明
  3. 未在您的库或最终项目中导出的 Android 依赖项或 Android 私有库
于 2013-07-26T05:59:55.123 回答
0

Properties--->Android-->Add 选择库项目,如果您使用的是 ADT 22,请检查 Order&Export 选项卡中的 Android Dependencies & Android Private Libraries。

于 2013-07-26T06:14:22.330 回答