1

我有个问题。项目运行时,我很少遇到致命异常。对于不同的构建变体,我在同一个项目中有两个不同的 android 应用程序。但是它们的包名不同。在清单文件中,写入了我的第一个应用程序的包名。当我运行我的第二个项目时,我很少遇到致命异常。

我该如何解决这个错误?

06-15 10:58:19.104 2322-2322/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process:  com.xxx.yyy.zzz, PID: 2322
                                                 java.lang.RuntimeException:Unable to instantiate application android.app.Application: java.lang.IllegalStateException: Unable to get package info for >com.xxx.yyy.zzz; is package not installed?
                                                     at android.app.LoadedApk.makeApplication(LoadedApk.java:563)
                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4526)
                                                     at android.app.ActivityThread.access$1500(ActivityThread.java:151)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:135)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5254)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at java.lang.reflect.Method.invoke(Method.java:372)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
                                                  Caused by: java.lang.IllegalStateException: Unable to get package info for com.xxx.yyy.zzz; is package not installed?
                                                     at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:409)
                                                     at android.app.LoadedApk.makeApplication(LoadedApk.java:555)
                                                     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4526) 
                                                     at android.app.ActivityThread.access$1500(ActivityThread.java:151) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:135) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5254) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:372) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
4

1 回答 1

0

You should control your architecture, does anywhere else control your build variants or have your project any xml file regarding build-variants as static string.

于 2016-10-07T12:24:20.973 回答