Eclipse - 不幸的是应用程序已停止 - ClassNotFoundException:在路径上找不到 class
Eclipse - unfortunately app has stopped - ClassNotFoundException: Didn't find class on path
我是 Android 的新手,还在学习 java、xml 等。这是我的第一个项目,但仍然出错。在模拟器中说:"Unfortunately App has stopped"..我需要帮助..拜托...!!
Logcat的错误日志
11-10 22:42:28.700: E/AndroidRuntime(1627): FATAL EXCEPTION: main
11-10 22:42:28.700: E/AndroidRuntime(1627): Process: id.co.kendaricall, PID: 1627
11-10 22:42:28.700: E/AndroidRuntime(1627): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{id.co.kendaricall/id.co.kendaricall.KategoryActivity}: java.lang.ClassNotFoundException: Didn't find class "id.co.kendaricall.KategoryActivity" on path: DexPathList[[zip file "/data/app/id.co.kendaricall-2.apk"],nativeLibraryDirectories=[/data/app-lib/id.co.kendaricall-2, /system/lib]]
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.access0(ActivityThread.java:135)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.os.Handler.dispatchMessage(Handler.java:102)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.os.Looper.loop(Looper.java:136)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.main(ActivityThread.java:5001)
11-10 22:42:28.700: E/AndroidRuntime(1627): at java.lang.reflect.Method.invokeNative(Native Method)
11-10 22:42:28.700: E/AndroidRuntime(1627): at java.lang.reflect.Method.invoke(Method.java:515)
11-10 22:42:28.700: E/AndroidRuntime(1627): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-10 22:42:28.700: E/AndroidRuntime(1627): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-10 22:42:28.700: E/AndroidRuntime(1627): at dalvik.system.NativeStart.main(Native Method)
11-10 22:42:28.700: E/AndroidRuntime(1627): Caused by: java.lang.ClassNotFoundException: Didn't find class "id.co.kendaricall.KategoryActivity" on path: DexPathList[[zip file "/data/app/id.co.kendaricall-2.apk"],nativeLibraryDirectories=[/data/app-lib/id.co.kendaricall-2, /system/lib]]
11-10 22:42:28.700: E/AndroidRuntime(1627): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
11-10 22:42:28.700: E/AndroidRuntime(1627): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
11-10 22:42:28.700: E/AndroidRuntime(1627): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
11-10 22:42:28.700: E/AndroidRuntime(1627): ... 11 more
这是 manifest.xml 文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="id.co.kendaricall"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/KendariCallTheme">
<uses-library android:name="com.google.android.maps"
android:required="false" />
<activity android:name=".KategoryActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".KontakDetailActivity" />
<activity android:name=".SettingActivity" />
<activity android:name=".TemplateActivity" />
<activity android:name=".KontakListActivity" />
<activity android:name=".PencarianActivity" />
<activity android:name=".KontakFavoritActivity" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PRIVILEDGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>
我想所有的旅游 activity 类 都放在任何其他包裹中。转到 id.co.kendaricall 文件夹并检查天气 activity 类 是否存在。如果没有,则找到所有 类 保存的文件夹。假设所有 类 都保存在包 id.co.kendaricall.activity 中,因此在 manifest
中进行更改
<activity android:name="activity.KontakDetailActivity" />
<activity android:name="activity.SettingActivity" />
<activity android:name="activity.TemplateActivity" />
<activity android:name="activity.KontakListActivity" />
<activity android:name="activity.PencarianActivity" />
<activity android:name="activity.KontakFavoritActivity" />
谢谢。
我是 Android 的新手,还在学习 java、xml 等。这是我的第一个项目,但仍然出错。在模拟器中说:"Unfortunately App has stopped"..我需要帮助..拜托...!!
Logcat的错误日志
11-10 22:42:28.700: E/AndroidRuntime(1627): FATAL EXCEPTION: main
11-10 22:42:28.700: E/AndroidRuntime(1627): Process: id.co.kendaricall, PID: 1627
11-10 22:42:28.700: E/AndroidRuntime(1627): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{id.co.kendaricall/id.co.kendaricall.KategoryActivity}: java.lang.ClassNotFoundException: Didn't find class "id.co.kendaricall.KategoryActivity" on path: DexPathList[[zip file "/data/app/id.co.kendaricall-2.apk"],nativeLibraryDirectories=[/data/app-lib/id.co.kendaricall-2, /system/lib]]
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.access0(ActivityThread.java:135)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.os.Handler.dispatchMessage(Handler.java:102)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.os.Looper.loop(Looper.java:136)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.main(ActivityThread.java:5001)
11-10 22:42:28.700: E/AndroidRuntime(1627): at java.lang.reflect.Method.invokeNative(Native Method)
11-10 22:42:28.700: E/AndroidRuntime(1627): at java.lang.reflect.Method.invoke(Method.java:515)
11-10 22:42:28.700: E/AndroidRuntime(1627): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-10 22:42:28.700: E/AndroidRuntime(1627): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-10 22:42:28.700: E/AndroidRuntime(1627): at dalvik.system.NativeStart.main(Native Method)
11-10 22:42:28.700: E/AndroidRuntime(1627): Caused by: java.lang.ClassNotFoundException: Didn't find class "id.co.kendaricall.KategoryActivity" on path: DexPathList[[zip file "/data/app/id.co.kendaricall-2.apk"],nativeLibraryDirectories=[/data/app-lib/id.co.kendaricall-2, /system/lib]]
11-10 22:42:28.700: E/AndroidRuntime(1627): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
11-10 22:42:28.700: E/AndroidRuntime(1627): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
11-10 22:42:28.700: E/AndroidRuntime(1627): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
11-10 22:42:28.700: E/AndroidRuntime(1627): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
11-10 22:42:28.700: E/AndroidRuntime(1627): ... 11 more
这是 manifest.xml 文件
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="id.co.kendaricall"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/KendariCallTheme">
<uses-library android:name="com.google.android.maps"
android:required="false" />
<activity android:name=".KategoryActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".KontakDetailActivity" />
<activity android:name=".SettingActivity" />
<activity android:name=".TemplateActivity" />
<activity android:name=".KontakListActivity" />
<activity android:name=".PencarianActivity" />
<activity android:name=".KontakFavoritActivity" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CALL_PRIVILEDGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
</manifest>
我想所有的旅游 activity 类 都放在任何其他包裹中。转到 id.co.kendaricall 文件夹并检查天气 activity 类 是否存在。如果没有,则找到所有 类 保存的文件夹。假设所有 类 都保存在包 id.co.kendaricall.activity 中,因此在 manifest
中进行更改<activity android:name="activity.KontakDetailActivity" />
<activity android:name="activity.SettingActivity" />
<activity android:name="activity.TemplateActivity" />
<activity android:name="activity.KontakListActivity" />
<activity android:name="activity.PencarianActivity" />
<activity android:name="activity.KontakFavoritActivity" />
谢谢。