Android Runtime exception analysis (continuous update)

Source: Internet
Author: User

1.java.lang.illegalaccessexception:access to class not allowed

Reason: No class is set to public when writing class file

2.java.lang.runtimeexception:unable to instantiate activity ComponentInfo

Reason:

There are three scenarios in which activity cannot be instantiated:

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

B. Create a new package yourself, and the default package is still used when registering, for example, the default package is the 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.

C. Also use one is that your firstactivity is defined as an abstract class, which seems like the average person does not commit.

D. Just can't access, don't set that class to public

Android Runtime exception analysis (continuous update)

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.