如何实现GeckoView?

时间:2019-05-07 10:03:32

标签: android gecko

我想在我的应用程序中实现GeckoView,但是我总是遇到以下错误:

  1. 当我按照此链接中的说明实施时:https://wiki.mozilla.org/Mobile/GeckoView

在安装应用程序时发生以下错误:

  

安装失败,并显示消息无法提交安装会话   2023122124,使用命令cmd软件包install-commit2023122124。错误:   INSTALL_FAILED_NO_MATCHING_ABIS:无法提取本机库,   res = -113。通过卸载可以解决此问题   apk的现有版本(如果存在),然后   重新安装。

     

警告:卸载将删除应用程序数据!

     

您要卸载现有应用程序吗?

  1. 当我单击“确定”时,在“调试”选项卡中会出现以下错误:
  

05/07 10:56:14:启动应用   $ adb install-multiple -r -t   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_6.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_0.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_1.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_2.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_7.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_4.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ resources \ instant-run \ x86_64 \ debug \ resources-x86_64-debug.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_5.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_9.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_3.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ slices \ slice_8.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ split-apk \ x86_64 \ debug \ dep \ dependencies.apk   C:\ Users \ USERNAME \ Desktop \ GeckoViewTest \ app \ build \ intermediates \ instant-run-apk \ x86_64 \ debug \ app-x86_64-debug.apk   $ adb shell pm卸载de.example.test.geckoviewtest未知   失败:执行时发生异常:   java.lang.IllegalArgumentException:未知软件包:   de.example.test.geckoviewtest在   com.android.server.pm.Settings.isOrphaned(Settings.java:4289)在   com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:21095)   在   com.android.server.pm.PackageManagerService.deletePackageVersioned(PackageManagerService.java:17916)   在   com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:736)   在   com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:1486)   在   com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:193)   在android.os.ShellCommand.exec(ShellCommand.java:103)处   com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21328)   在android.os.Binder.shellCommand(Binder.java:634)处   android.os.Binder.onTransact(Binder.java:532)在   android.content.pm.IPackageManager $ Stub.onTransact(IPackageManager.java:2821)   在   com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3856)   在android.os.Binder.execTransact(Binder.java:731)时出错   安装APK

我在productFlavors {...}下添加了此代码,并可以安装该应用程序:

splits {
    abi {
        enable true
        reset()
        include 'x86', 'x86_64', 'arm64-v8a', 'armeabi-v7a'
        universalApk true
    }
}

但是现在我的应用崩溃了:

GeckoRuntime runtime = GeckoRuntime.create(this);

,我在活动的onCreate中收到以下错误:

  

2019-05-07 10:58:31.347 9069-9090 / de.example.test.geckoviewtest   E / GeckoLoader:无法加载Mozglue。尝试本地库目录。   2019-05-07 10:58:31.368 9069-9090 / de.example.test.geckoviewtest   E / GeckoLoader:库应该存在时不存在。 2019-05-07   10:58:31.382 9069-9090 / de.example.test.geckoviewtest E / GeckoLoader:   无法加载   /data/user/0/de.example.test.geckoviewtest/lib/libmozglue.so:   java.lang.UnsatisfiedLinkError:dlopen失败:库   “ /data/user/0/de.example.test.geckoviewtest/lib/libmozglue.so”不是   发现2019-05-07 10:58:31.392 9069-9090 / de.example.test.geckoviewtest   E / GeckoLoader:无法加载   /data/app-lib/de.example.test.geckoviewtest/libmozglue.so:   java.lang.UnsatisfiedLinkError:dlopen失败:库   找不到“ /data/app-lib/de.example.test.geckoviewtest/libmozglue.so”   2019-05-07 10:58:31.409 9069-9090 / de.example.test.geckoviewtest   E / GeckoLoader:无法加载   /data/data/de.example.test.geckoviewtest/lib/libmozglue.so:   java.lang.UnsatisfiedLinkError:dlopen失败:库   找不到“ /data/data/de.example.test.geckoviewtest/lib/libmozglue.so”   2019-05-07 10:58:31.420 9069-9090 / de.example.test.geckoviewtest   W / GeckoLoader:在APK中找不到lib / x86 / libmozglue.so   /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/base.apk   2019-05-07 10:58:31.423 9069-9090 / de.example.test.geckoviewtest   E / GeckoLoader:负载诊断:LOAD mozglue:ABI:x86_64-gcc3,x86:   数据:/data/user/0/de.example.test.geckoviewtest、ax=false、ddx=false,   -1x = false,-2x = false,nativeLib:/data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/lib/x86,   dirx = false,libx = false      ---------崩溃开始   2019-05-07 10:58:31.438 9069-9090 / de.example.test.geckoviewtest   E / AndroidRuntime:致命例外:Gecko       流程:de.example.test.geckoviewtest,PID:9069       java.lang.RuntimeException:LOAD mozglue:ABI:x86_64-gcc3,x86:Data:/data/user/0/de.example.test.geckoviewtest,ax = false,ddx = false,   -1x = false,-2x = false,nativeLib:/data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/lib/x86,   dirx = false,libx = false           在org.mozilla.gecko.mozglue.GeckoLoader.doLoadLibrary(GeckoLoader.java:426)           在org.mozilla.gecko.mozglue.GeckoLoader.loadMozGlue(GeckoLoader.java:434)           在org.mozilla.gecko.GeckoThread.initGeckoEnvironment(GeckoThread.java:287)           在org.mozilla.gecko.GeckoThread.run(GeckoThread.java:448)        引起原因:java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader [DexPathList [[zip文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/base.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_dependencies_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_resources_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_0_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_1_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_2_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_3_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_4_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_5_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_6_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_7_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_8_apk.apk”,   压缩文件   “ /data/app/de.example.test.geckoviewtest-ED_fDOF4yrCjKrHnYMiPhQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/de.example.test.geckoviewtest-ED_fDOF/yrCjKrHnYMi   / system / lib]]]找不到“ libmozglue.so”           在java.lang.Runtime.loadLibrary0(Runtime.java:1012)           在java.lang.System.loadLibrary(System.java:1669)           在org.mozilla.gecko.mozglue.GeckoLoader.doLoadLibraryExpected(GeckoLoader.java:347)           在org.mozilla.gecko.mozglue.GeckoLoader.doLoadLibrary(GeckoLoader.java:373)           在org.mozilla.gecko.mozglue.GeckoLoader.loadMozGlue(GeckoLoader.java:434)           在org.mozilla.gecko.GeckoThread.initGeckoEnvironment(GeckoThread.java:287)           在org.mozilla.gecko.GeckoThread.run(GeckoThread.java:448)

1 个答案:

答案 0 :(得分:2)

壁虎构建似乎没有针对您要定位的体系结构提供适当的库mozglue(即您的设备需要x86,而您正在构建arm64)。 您需要确保为您的架构导入正确的

implementation "org.mozilla.geckoview:geckoview-arm64-v8a:69.0.20190903125908" \\for arm 64
implementation "org.mozilla.geckoview:geckoview-armeabi-v7a:69.0.20190903125908" \\for arm v7
implementation "org.mozilla.geckoview:geckoview-x86:69.0.20190903125908" \\for x86 32 bit
implementation "org.mozilla.geckoview:geckoview-x86_64:69.0.20190903125908" \\for x86 64 bit