我对Android开发相对较新;我有一个从网站获取RSS订阅源的应用程序。当我打开列表视图中显示的文章列表,并尝试打开特定文章时,应用程序崩溃。
有人可以告诉我如何解决这个问题吗?
我已将ACRA放入应用程序中,并通过电子邮件发送崩溃报告。它们输入下面。非常感谢帮助!
以下是获得的堆栈跟踪:
USER_COMMENT=null
ANDROID_VERSION=4.1.2
APP_VERSION_NAME=1.0
BRAND=samsung
PHONE_MODEL=GT-N8000
CUSTOM_DATA=
STACK_TRACE=android.content.ActivityNotFoundException: Unable to find explicit activity class {com.j.infographx/com.j.infographx.DisPlayWebPageActivity}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1556)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1431)
at android.app.Activity.startActivityForResult(Activity.java:3428)
at android.app.Activity.startActivityForResult(Activity.java:3389)
at android.app.Activity.startActivity(Activity.java:3599)
at android.app.Activity.startActivity(Activity.java:3567)
at com.j.infographx.ListRSSItemsActivity$1.onItemClick(ListRSSItemsActivity.java:79)
at android.widget.AdapterView.performItemClick(AdapterView.java:301)
at android.widget.AbsListView.performItemClick(AbsListView.java:1287)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3078)
at android.widget.AbsListView$1.run(AbsListView.java:4161)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.j.infographx"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<!-- Internet Permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:name="MyApplication">
<activity
android:configChanges="keyboardHidden|orientation"
android:name="com.j.infographx.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Add New Site Activity -->
<activity android:name=".AddNewSiteActivity"/>
<!-- List rss items Activity -->
<activity android:name=".ListRSSItemsActivity"
android:configChanges="keyboardHidden|orientation"/>
<!-- Display webpage Activity -->
<activity android:name=".DisplayWebPageActivity"
android:theme="@android:style/Theme.NoTitleBar"
android:configChanges="keyboardHidden|orientation"/>
</application>
</manifest>
答案 0 :(得分:2)
您必须在清单中声明活动。像这样:
<activity
android:name="com.j.infographx.DisPlayWebPageActivity">
</activity>
答案 1 :(得分:1)
您是否在AndroidManifest.xml中声明了此活动?
=&GT; Logcat输出表明您尚未在AndroidManifest.xml文件中声明活动。你可能在名字上犯了错误。
答案 2 :(得分:1)
ActivityNotFoundException:表示你应该在Androidmanifest.xml中注册Activity
喜欢:
<activity
android:name="com.example.MainActivity"
android:label="@string/app_name" >
</activity>
答案 3 :(得分:0)
尝试:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.j.infographx"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
android:name=".MainActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="@string/app_name"
android:name=".DisPlayWebPageActivity" >
</activity>
</application>
</manifest>
查看this示例了解更多详情。