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

Source: Internet
Author: User

There are three scenarios in which activity cannot be instantiated:

1. The activity has not been registered in the manifest.xml manifest, or the class name of the package name or activity has been modified after the activity has been created, and the configuration manifest has not been modified to create an instantiation.

2. Create a new package yourself, and the default package is still used when registering, for example, the default package is Com.ghg.Dao package, you create a new Com.ghg.DaoImpl package, and write a firstactivity in this package, when you register in Manifest.xml you write <activity android:name= ". Firstactivity "/>, at this time the equivalent of your class registered to the default package, the system is not found in the default package, because your firstactivity under the Com.ghg.DaoImpl package, so you should register as a package name plus class name, such as:< Activity android:name= "com.ghg.DaoImpl.FirstActivity" so that the system can find the corresponding class in the specified package.

3. It is also the case that your firstactivity is defined as an abstract class, which is not likely to be made by ordinary people.

If the above three cases are taken into account, and the exception is thrown, check to see if the class's constructors and OnCreate () are present in the activity class, and if so, then delete the constructor and put the initialization in

Try it in OnCreate ().

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

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

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.