0

我为连接到互联网的android编写了一个程序。

我收到以下错误:

The application has stopped unexpectedly.Please try again..

有什么问题?

Eclipse中的log cat如下:

09-02 12:43:42.421: W/dalvikvm(12362): threadid=1: thread exiting with uncaught exception (group=0x40018578)
09-02 12:43:42.437: E/AndroidRuntime(12362): FATAL EXCEPTION: main
09-02 12:43:42.437: E/AndroidRuntime(12362): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.networkusage/com.example.networkusage.NetworkActivity}: java.lang.ClassNotFoundException: com.example.networkusage.NetworkActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.android.networkusage-1.apk]
09-02 12:43:42.437: E/AndroidRuntime(12362):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at android.os.Handler.dispatchMessage(Handler.java:99)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at android.os.Looper.loop(Looper.java:130)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at android.app.ActivityThread.main(ActivityThread.java:3687)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at java.lang.reflect.Method.invokeNative(Native Method)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at java.lang.reflect.Method.invoke(Method.java:507)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at dalvik.system.NativeStart.main(Native Method)
09-02 12:43:42.437: E/AndroidRuntime(12362): Caused by: java.lang.ClassNotFoundException: com.example.networkusage.NetworkActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.android.networkusage-1.apk]
09-02 12:43:42.437: E/AndroidRuntime(12362):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
09-02 12:43:42.437: E/AndroidRuntime(12362):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
09-02 12:43:42.437: E/AndroidRuntime(12362):    ... 11 more
4

2 回答 2

1

发现我的包名是:

com.example.android.networkusage

在清单上是:

android:name="com.example.networkusage.NetworkActivity"

所以将清单更改为:

android:name="com.example.android.networkusage.NetworkActivity"

于 2012-09-18T13:40:30.013 回答
0

看起来你的com.example.networkusage.NetworkActivity课不见了。

如果它在外部库中声明,则将该jar 文件添加到“ libs ”文件夹并将其添加到构建路径,然后再次构建您的项目

也不要忘记清洁它!

于 2012-09-02T11:20:12.813 回答