在Android开发方面,我是新手。我试图在模拟器中运行一个项目,但我收到一条消息“不幸的是Appname已停止”。我不确定有什么问题,如果你们能帮忙,那真的很棒。一步一步的指南将非常感激。
这是日志文件
07-02 10:42:52.114: D/AndroidRuntime(2219): Shutting down VM 07-02 10:42:52.114: W/dalvikvm(2219): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 07-02 10:42:52.134: E/AndroidRuntime(2219): FATAL EXCEPTION: main 07-02 10:42:52.134: E/AndroidRuntime(2219): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{brewedapps.app55/com.koutymony.webview.WebViewActivity}: java.lang.ClassNotFoundException: Didn't find class "com.koutymony.webview.WebViewActivity" on path: /data/app/brewedapps.app55-1.apk 07-02 10:42:52.134: E/AndroidRuntime(2219): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) 07-02 10:42:52.134: E/AndroidRuntime(2219): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 07-02 10:42:52.134: E/AndroidRuntime(2219): at android.app.ActivityThread.access$600(ActivityThread.java:141) 07-02 10:42:52.134: E/AndroidRuntime(2219): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 07-02 10:42:52.134: E/AndroidRuntime(2219): at android.os.Handler.dispatchMessage(Handler.java:99) 07-02 10:42:52.134: E/AndroidRuntime(2219): at android.os.Looper.loop(Looper.java:137) 07-02 10:42:52.134: E/AndroidRuntime(2219): at android.app.ActivityThread.main(ActivityThread.java:5041) 07-02 10:42:52.134: E/AndroidRuntime(2219): at java.lang.reflect.Method.invokeNative(Native Method) 07-02 10:42:52.134: E/AndroidRuntime(2219): at java.lang.reflect.Method.invoke(Method.java:511) 07-02 10:42:52.134: E/AndroidRuntime(2219): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 07-02 10:42:52.134: E/AndroidRuntime(2219): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 07-02 10:42:52.134: E/AndroidRuntime(2219): at dalvik.system.NativeStart.main(Native Method) 07-02 10:42:52.134: E/AndroidRuntime(2219): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.koutymony.webview.WebViewActivity" on path: /data/app/brewedapps.app55-1.apk 07-02 10:42:52.134: E/AndroidRuntime(2219): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) 07-02 10:42:52.134: E/AndroidRuntime(2219): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 07-02 10:42:52.134: E/AndroidRuntime(2219): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 07-02 10:42:52.134: E/AndroidRuntime(2219): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 07-02 10:42:52.134: E/AndroidRuntime(2219): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 07-02 10:42:52.134: E/AndroidRuntime(2219): ... 11 more 07-02 10:42:56.068: I/Process(2219): Sending signal. PID: 2219 SIG: 9 07-02 10:43:39.584: E/Trace(2247): error opening trace file: No such file or directory (2) 07-02 10:43:39.674: D/AndroidRuntime(2247): Shutting down VM 07-02 10:43:39.674: W/dalvikvm(2247): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 07-02 10:43:39.704: E/AndroidRuntime(2247): FATAL EXCEPTION: main 07-02 10:43:39.704: E/AndroidRuntime(2247): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{brewedapps.app55/com.koutymony.webview.WebViewActivity}: java.lang.ClassNotFoundException: Didn't find class "com.koutymony.webview.WebViewActivity" on path: /data/app/brewedapps.app55-1.apk 07-02 10:43:39.704: E/AndroidRuntime(2247): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) 07-02 10:43:39.704: E/AndroidRuntime(2247): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 07-02 10:43:39.704: E/AndroidRuntime(2247): at android.app.ActivityThread.access$600(ActivityThread.java:141) 07-02 10:43:39.704: E/AndroidRuntime(2247): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 07-02 10:43:39.704: E/AndroidRuntime(2247): at android.os.Handler.dispatchMessage(Handler.java:99) 07-02 10:43:39.704: E/AndroidRuntime(2247): at android.os.Looper.loop(Looper.java:137) 07-02 10:43:39.704: E/AndroidRuntime(2247): at android.app.ActivityThread.main(ActivityThread.java:5041) 07-02 10:43:39.704: E/AndroidRuntime(2247): at java.lang.reflect.Method.invokeNative(Native Method) 07-02 10:43:39.704: E/AndroidRuntime(2247): at java.lang.reflect.Method.invoke(Method.java:511) 07-02 10:43:39.704: E/AndroidRuntime(2247): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 07-02 10:43:39.704: E/AndroidRuntime(2247): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 07-02 10:43:39.704: E/AndroidRuntime(2247): at dalvik.system.NativeStart.main(Native Method) 07-02 10:43:39.704: E/AndroidRuntime(2247): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.koutymony.webview.WebViewActivity" on path: /data/app/brewedapps.app55-1.apk 07-02 10:43:39.704: E/AndroidRuntime(2247): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) 07-02 10:43:39.704: E/AndroidRuntime(2247): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 07-02 10:43:39.704: E/AndroidRuntime(2247): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 07-02 10:43:39.704: E/AndroidRuntime(2247): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 07-02 10:43:39.704: E/AndroidRuntime(2247): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 07-02 10:43:39.704: E/AndroidRuntime(2247): ... 11 more
更新日志文件:
07-02 14:06:12.944: E/Trace(780): error opening trace file: No such file or directory (2) 07-02 14:06:13.133: D/AndroidRuntime(780): Shutting down VM 07-02 14:06:13.133: W/dalvikvm(780): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 07-02 14:06:13.153: E/AndroidRuntime(780): FATAL EXCEPTION: main 07-02 14:06:13.153: E/AndroidRuntime(780): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.koutymony.webview/com.koutymony.webview.WebViewActivity}: java.lang.ClassNotFoundException: Didn't find class "com.koutymony.webview.WebViewActivity" on path: /data/app/com.koutymony.webview-2.apk 07-02 14:06:13.153: E/AndroidRuntime(780): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) 07-02 14:06:13.153: E/AndroidRuntime(780): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 07-02 14:06:13.153: E/AndroidRuntime(780): at android.app.ActivityThread.access$600(ActivityThread.java:141) 07-02 14:06:13.153: E/AndroidRuntime(780): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 07-02 14:06:13.153: E/AndroidRuntime(780): at android.os.Handler.dispatchMessage(Handler.java:99) 07-02 14:06:13.153: E/AndroidRuntime(780): at android.os.Looper.loop(Looper.java:137) 07-02 14:06:13.153: E/AndroidRuntime(780): at android.app.ActivityThread.main(ActivityThread.java:5041) 07-02 14:06:13.153: E/AndroidRuntime(780): at java.lang.reflect.Method.invokeNative(Native Method) 07-02 14:06:13.153: E/AndroidRuntime(780): at java.lang.reflect.Method.invoke(Method.java:511) 07-02 14:06:13.153: E/AndroidRuntime(780): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 07-02 14:06:13.153: E/AndroidRuntime(780): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 07-02 14:06:13.153: E/AndroidRuntime(780): at dalvik.system.NativeStart.main(Native Method) 07-02 14:06:13.153: E/AndroidRuntime(780): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.koutymony.webview.WebViewActivity" on path: /data/app/com.koutymony.webview-2.apk 07-02 14:06:13.153: E/AndroidRuntime(780): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) 07-02 14:06:13.153: E/AndroidRuntime(780): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 07-02 14:06:13.153: E/AndroidRuntime(780): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 07-02 14:06:13.153: E/AndroidRuntime(780): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 07-02 14:06:13.153: E/AndroidRuntime(780): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 07-02 14:06:13.153: E/AndroidRuntime(780): ... 11 more
以下是AndroidManifest.xml中的代码
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="preferExternal"
package="brewedapps.app55">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:label="@string/app_name"
android:icon="@drawable/ic_launcher">
<activity
android:label="@string/app_name"
android:name="com.koutymony.webview.WebViewActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity android:name="com.appbrain.AppBrainActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
<service android:name="com.appbrain.AppBrainService" />
<receiver android:name="com.appbrain.ReferrerReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
</application>
</manifest>
答案 0 :(得分:3)
请在com.koutymony.webview.WebViewActivity
内的AndroidManifest.xml
内声明此课程<application><application/>
,如下所示:
<activity android:name="brewedapps.app55.WebViewActivity"/>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="preferExternal"
package="brewedapps.app55">
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="14" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:label="@string/app_name"
android:icon="@drawable/ic_launcher">
<activity
android:label="@string/app_name"
android:name="brewedapps.app55.WebViewActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<activity android:name="com.appbrain.AppBrainActivity" android:configChanges="keyboard|keyboardHidden|orientation" />
<service android:name="com.appbrain.AppBrainService" />
<receiver android:name="com.appbrain.ReferrerReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
</application>
</manifest>
您的应用程序包应如下图所示:
PackageName: brewedapps.app55
类名: WebViewActivity.java
答案 1 :(得分:0)
看起来应该是这样。
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.yourpackage"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.koutymony.webview.WebViewActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
答案 2 :(得分:0)
在清单文件中声明您的活动
<activity
android:name="com.koutymony.webview.WebViewActivity">
</activity>