Java – Unable to instantiate application – Unable to get package information

Unable to instantiate application – Unable to get package information… here is a solution to the problem.

Unable to instantiate application – Unable to get package information

I

unexpectedly receive the following error when I try to run my application, and I can’t instantiate my application. I’ve included the log cat below. I feel that the package name does not match the package name, so it may be a bug.

10-06 05:44:38.913: E/AndroidRuntime(2056): FATAL EXCEPTION: main
10-06 05:44:38.913: E/AndroidRuntime(2056): java.lang.RuntimeException: Unable to instantiate application com.dooba.beta.IntegratingFacebookTutorialApplication: java.lang.IllegalStateException: Unable to get package info for com.dooba.beta; is package not installed?
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.app.LoadedApk.makeApplication(LoadedApk.java:509)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4417)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.app.ActivityThread.access$1300(ActivityThread.java:141)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.os.Looper.loop(Looper.java:137)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.app.ActivityThread.main(ActivityThread.java:5103)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at java.lang.reflect.Method.invokeNative(Native Method)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at java.lang.reflect.Method.invoke(Method.java:525)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at dalvik.system.NativeStart.main(Native Method)
10-06 05:44:38.913: E/AndroidRuntime(2056): Caused by: java.lang.IllegalStateException: Unable to get package info for com.dooba.beta; is package not installed?
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:369)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.app.LoadedApk.getClassLoader(LoadedApk.java:322)
10-06 05:44:38.913: E/AndroidRuntime(2056):     at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
10-06 05:44:38.913: E/AndroidRuntime(2056):     ... 11 more

list

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dooba.beta"
android:versionCode="1"
android:versionName="1.0" >

<uses-permission android:name="com.dooba.beta.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

<!-- for card.io card scanning -->
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />

<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />

<!-- for most things, including card.io & PayPal -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

<!--
IMPORTANT: Change "com.parse.starter.permission.C2D_MESSAGE" in the lines below
to match your app's package name + ".permission. C2D_MESSAGE".
-->
<permission android:protectionLevel="signature"
android:name="com.dooba.beta.permission.C2D_MESSAGE" />
<uses-permission android:name="com.dooba.beta.permission.C2D_MESSAGE" />

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="19" />

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
    android:name="com.dooba.beta.IntegratingFacebookTutorialApplication"
    android:allowBackup="true"
    android:largeHeap = "true"
    android:icon="@drawable/logo3"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.dooba.beta.LoginActivity"
        android:label="@string/app_name"
        android:launchMode="singleTop"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Holo.Light.NoActionBar" > 

<intent-filter>
            <action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
        </intent-filter> 

</activity>
    <activity
        android:name="com.dooba.beta.UserDetailsActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@style/CustomActionBarTheme">

</activity>

</application>
</manifest>

Solution

Simply uninstall the application and then run it again, which happens when dalvik reinstalls the .apk file and tries to reuse the previous activity in the same package

Related Problems and Solutions