?完整報錯信息
E/AndroidRuntime: FATAL EXCEPTION: main
??? Process: com.example.app01, PID: 13901
??? android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.app01/com.example.app01.RegisterActivity}; have you declared this activity in your AndroidManifest.xml?
?解決方案
根據(jù)日志信息不難發(fā)現(xiàn)問題的所在,就是我們需要將存在的activity在清單文件AndroidManifest.xml中進行配置才可以成為真正有效的活動單元,否則無法執(zhí)行啟動。
配置Activity語法:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.app01">
<application>
<activity android:name=".activity的類名" />
</application>
</manifest>
手動如下:
自動配置小技巧:
????????鼠標單擊activity使光標在上面閃爍,然后使用快捷鍵 Alt+Enter 選擇 Add activity to manifest 即可實現(xiàn)將當前activity自動配置到清單文件AndroidManifest.xml中,非常方便!
文章來源:http://www.zghlxwxcb.cn/news/detail-586716.html
END.文章來源地址http://www.zghlxwxcb.cn/news/detail-586716.html
到了這里,關(guān)于Android開發(fā)頁面跳轉(zhuǎn)異常且應用停止:android.content.ActivityNotFoundException: Unable to find explicit activity的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!