Java.lang.RuntimeException:Unable to instantiate activity ComponentInfo Exception Summary
Android development may have encountered "java.lang.RuntimeException:Unable to instantiate activity ComponentInfo" over this anomaly,
Sometimes it Conslole happens.Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
Workaround 1. The most common reason is to create a new activity, and after the code has been written, forget to configure the activity in Manifest.xml with the exception above. There is a change in the activity's class name or package name, but not in the Manifest.xml file to make the corresponding changes. 2. When registering for activity, omit the application for direct use. Xxxactivity "to replace the full path of activity. For example, the following code in the default package name is "com.location.activity" (3rd line of the program), when registering the activity, if the activity is indeed under the package, you can use ". Xxxactivity "instead (note that the point before the activity class name is not to be omitted!) Of course, you can also use the full path as shown in line 11th of the following code. However, if the new activity is not under the default package, the package name is omitted immediately. Xxxactivity "To replace will appear" java.lang.RuntimeException:Unable to instantiate activity ComponentInfo ... "exception, it must be represented by the full path, The format is shown in line 11th of the following code, which is the name of the package name +activity, such as "xxx.xxx.xxx.XxxActivity".
[HTML] View plaincopy on code to see a snippet derived from my Code slice
<?xml version= "1.0" encoding= "Utf-8"?>
<manifest xmlns:android="Http://schemas.android.com/apk/res/android"
package ="Com.location.activity"
Android:versioncode="1"
android:versionname="1.0" >
<application
Android:icon="@drawable/ic_launcher"
Android:label="@string/app_name" >
<activity
android:name="Com.location.activity.LocationActivity"
Android:label="@string/app_name" >
<intent-filter>
<action android:name="Android.intent.action.MAIN" />
<category android:name="Android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
......
3. "Java.lang.RuntimeException:Unable to instantiate activity ComponentInfo" may appear if you update the new ADT version and the other jar packages are used in the project file This exception, treatment: Project, Properties->java build path-> Order & Export Select private and then Clean project. 4. Another possibility is that you have added a new jar package, but at compile time is not checked, the processing method is the same as 3, if there is an error may be added to the jar package needs to be compiled first. Processing method: Right-click the project file –>build path–>configure Build path–>order and Export then select the filled jar package up or down to adjust the compilation order.
Java.lang.RuntimeException:Unable to instantiate activity ComponentInfo Exception Summary