编程语言
首页 > 编程语言> > java-无法实例化应用程序-无法获取包信息

java-无法实例化应用程序-无法获取包信息

作者:互联网

尝试运行我的应用程序时,我意外收到以下错误:无法实例化应用程序.我在下面包括了日志猫.我认为程序包名称与程序包名称不一致,因此可能是错误.

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

表现

<?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>

解决方法:

只需卸载应用程序,然后再次运行,当dalvik重新安装.apk文件并尝试重用同一软件包中的先前活动时,就会发生这种情况

标签:parse-platform,android-layout,android-activity,java,android
来源: https://codeday.me/bug/20191029/1957269.html