Java.lang.RuntimeException:Unable to instantiate activity ComponentInfo exception

Source: Internet
Author: User

Ext.: http://blog.csdn.net/gaohongijj/article/details/8010869/

There are three scenarios in which activity cannot be instantiated:

1. There is nomanifest.xmlList, register theActivity, or after the activity has been created, the package name or the class name of the activity is modified, and the configuration manifest is not modified, resulting in the inability to instantiate.

2. You create a new package, and the default package is still used when registering, for example, the default package isCom.ghg.DaoPackage, you've created a newCom.ghg.DaoImplPackage, and wrote in this package afirstactivityInmanifest.xmlWhen you register, you write<activity android:name= ". Firstactivity "/>, the equivalent of your class registered in the default package, the system is not found in the default package, because yourfirstactivityInCom.ghg.DaoImplPackage, so you should write the package name plus class name when registering, such as:<activity android:name= "com.ghg.DaoImpl.FirstActivity"/>So that the system can find the corresponding class in the specified package.

3. Still use one of yourfirstactivityis defined as an abstract class, which is not likely to be made by ordinary people.

If all three of the above are considered, and this exception is thrown, lookActivityDoes the class have both constructors andOnCreate ()If yes, then delete the constructor and put the initialization into

OnCreate ()Try it in.

Java.lang.RuntimeException:Unable to instantiate Activity ComponentInfo exception (RPM)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.