본문 바로가기

Programming/Error Note

[Android] android.content.ActivityNotFoundException

[Android] android.content.ActivityNotFoundException

  • Problem : AndroidManifest.xml에 Activity 항목을 추가를 안해서 에러가 발생
 
android.content.ActivityNotFoundException: Unable to find explicit activity class {kr.co.xxxx
.viewtest/kr.co.xxxx.viewtest.BlogActivity}; have you declared this activity in your AndroidManifest.xml?
                      at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1820)
                      at android.app.Instrumentation.execStartActivity(Instrumentation.java:1531)
                      at android.app.Activity.startActivityForResult(Activity.java:4399)
                      at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)
                      at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:67)
                      at android.app.Activity.startActivityForResult(Activity.java:4358)
                      at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:720)
                      at android.app.Activity.startActivity(Activity.java:4682)
                      at android.app.Activity.startActivity(Activity.java:4650)
                      at kr.co.xxxx.viewtest.BlogActivity.createInstance(BlogActivity.java:33)
                      at kr.co. xxxx
.viewtest.MainActivity.onClick(MainActivity.java:33)
                      at android.view.View.performClick(View.java:6205)
                      at android.widget.TextView.performClick(TextView.java:11103)
                      at android.view.View$PerformClick.run(View.java:23653)
                      at android.os.Handler.handleCallback(Handler.java:751)
                      at android.os.Handler.dispatchMessage(Handler.java:95)
                      at android.os.Looper.loop(Looper.java:154)
                      at android.app.ActivityThread.main(ActivityThread.java:6682)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

  • Solution : AndroidManifest.xml에 Activity 항목 추가
 
...
<activity android:name=".BlogActivity" />
...