浏览器应用程序 - 关闭 - 致命异常

时间:2016-09-22 19:15:44

标签: android android-studio-2.2

我正在尝试从Android工作室在我的Android手机上运行365浏览器应用程序。我想看看浏览器应用程序是如何配置的,所以我从github克隆了365浏览器应用程序并试图在android studio中运行它。但我得到致命的例外:

D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.mogoweb, PID: 18192
                  java.lang.RuntimeException: Unable to get provider org.chromium.chrome.browser.ChromeBrowserProvider: java.lang.ClassCastException: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to org.chromium.base.BaseChromiumApplication
                      at android.app.ActivityThread.installProvider(ActivityThread.java:5177)
                      at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769)
                      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709)
                      at android.app.ActivityThread.-wrap1(ActivityThread.java)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415)
                      at android.os.Handler.dispatchMessage(Handler.java:102)
                      at android.os.Looper.loop(Looper.java:148)
                      at android.app.ActivityThread.main(ActivityThread.java:5443)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
                   Caused by: java.lang.ClassCastException: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to org.chromium.base.BaseChromiumApplication
                      at org.chromium.base.BaseChromiumApplication.initCommandLine(BaseChromiumApplication.java:116)
                      at org.chromium.chrome.browser.ChromeBrowserProvider.onCreate(ChromeBrowserProvider.java:268)
                      at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
                      at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
                      at android.app.ActivityThread.installProvider(ActivityThread.java:5174)
                      at android.app.ActivityThread.installContentProviders(ActivityThread.java:4769) 
                      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4709) 
                      at android.app.ActivityThread.-wrap1(ActivityThread.java) 
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1415) 
                      at android.os.Handler.dispatchMessage(Handler.java:102) 
                      at android.os.Looper.loop(Looper.java:148) 
                      at android.app.ActivityThread.main(ActivityThread.java:5443) 
                      at java.lang.reflect.Method.invoke(Native Method) 
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) 
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) 
I/Process: Sending signal. PID: 18192 SIG: 9
Application terminated.

我不确定代码或设置的哪一部分导致了这个问题。任何人都可以告诉我哪个部分的错误实际上与问题有关,以及如何解决它?

当我在项目文件夹中搜索BaseChromiumApplication.java时,我得到ChromeFullScreenManager.java,并且该java文件包含以下行:

import org.chromium.base.BaseChromiumApplication;
import org.chromium.base.BaseChromiumApplication.WindowFocusChangedListener;

谢谢!

1 个答案:

答案 0 :(得分:1)

               Caused by: java.lang.ClassCastException: com.android.tools.fd.runtime.BootstrapApplication cannot be cast to org.chromium.base.BaseChromiumApplication
                  at org.chromium.base.BaseChromiumApplication.initCommandLine(BaseChromiumApplication.java:116)
                  at org.chromium.chrome.browser.ChromeBrowserProvider.onCreate(ChromeBrowserProvider.java:268)

参见BaseChromiumApplication.java中的第116行

变量,com.android.tools.fd.runtime.BootstrapApplication类型的对象无法转换为org.chromium.base.BaseChromiumApplication。 这些类型是无关的。为了使转换成功,必须从类型中创建对象类型,要将其强制转换为或者必须至少从该类型派生,如下所示:

对象
   Class_A,派生自对象
   Class_B,派生自Class_A
   Class_C,派生自Class_B

如果创建了Class_C类型的对象,以后可以将其完美地转换为Class_A,Class_B,Class_C或Object类型的对象。