“is package not installed?” exception for project have different build variants [duplicate]

雨燕双飞 提交于 2019-12-11 05:37:06

问题


I have a question. When project is run, I rarely get fatal exception. I have two different android applications in the same project for different build variants. But their package name are different. In manifest file, my first application's package name is written. I rarely get fatal exception, when I run my second project.

How can I fix this error?

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) 

回答1:


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.



来源:https://stackoverflow.com/questions/37830027/is-package-not-installed-exception-for-project-have-different-build-variants

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!