本文介绍了在 AOSP 崩溃中添加预构建的 Apk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • AOSP 10

OpenVPN 官方 应用

我正在尝试在 AOSP 中添加 OpenVPN 应用程序,但它崩溃了.我已经通过在设备中安装来检查它,当我从 playstore/f-droid 安装它或通过 adb install 下载 apk 时它工作正常.当我在 AOSP 源代码中添加这个 apk 时,它会被添加到构建 AOSP (OS) 中,但是当我在设备中刷新 AOSP 后启动应用程序时,它会在库中崩溃,然后我在 AOSP 中添加了所需的库,但现在它抛出了其他错误.AOSP (OS) 在两种情况下都是相同的.我也尝试过其他 VPN 应用程序,但都存在同样的问题.我在 AOSP 中添加了其他应用程序,它们运行良好,但这些 VPN 应用程序无法运行.

I am trying to add OpenVPN app in AOSP but it crashes. I have checked it by installing in device, it works fine when I install it from playstore/f-droid or downloaded apk through adb install. When I add this apk in aosp source code it gets added in build AOSP (OS) but when I launch app after flashing AOSP in device it crashes on libraries, Then I added its required libraries in AOSP, but now its throwing other errors. AOSP (OS) is same in both scenarios. I have also tried other VPN apps but same issue with all.I have added other apps in AOSP those works fine but these VPN apps not working.

这里是应用崩溃的 adb 日志

2020-10-16 10:12:49.736 0-0/? E/q6asm_callback: payload size of 8 is less than expected.

    --------- beginning of main
2020-10-16 10:12:51.759 1291-5412/? E/ACDB-LOADER: Error: ACDB AudProc vol returned = -19
2020-10-16 10:12:51.780 0-0/? E/q6asm_callback: payload size of 8 is less than expected.
2020-10-16 10:12:51.785 1568-1743/? E/system_server: Invalid ID 0x00000000.
2020-10-16 10:12:51.788 6354-6354/? E/q6asm_callback: payload size of 8 is less than expected.
2020-10-16 10:12:51.795 0-0/? E/q6asm_callback: payload size of 8 is less than expected.
2020-10-16 10:12:51.885 6354-6354/? E/SoLoader: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: couldn't map "/data/user/0/net.openvpn.openvpn/lib-main/libc++_shared.so" segment 1: Permission denied
2020-10-16 10:12:51.885 6354-6354/? E/SoLoader: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: couldn't map "/data/user/0/net.openvpn.openvpn/lib-main/libc++_shared.so" segment 1: Permission denied
2020-10-16 10:12:51.885 6354-6354/? E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: couldn't find DSO to load: libfb.so caused by: couldn't find DSO to load: libc++_shared.so caused by: dlopen failed: couldn't map "/data/user/0/net.openvpn.openvpn/lib-main/libc++_shared.so" segment 1: Permission denied
2020-10-16 10:12:51.888 6354-6380/? E/SoLoader: couldn't find DSO to load: libhermes.so

    --------- beginning of crash
2020-10-16 10:12:51.888 6354-6380/? E/AndroidRuntime: FATAL EXCEPTION: create_react_context
    Process: net.openvpn.openvpn, PID: 6354
    java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
        at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
        at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
        at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
        at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.java:20)
        at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:27)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:952)
        at java.lang.Thread.run(Thread.java:922)
2020-10-16 10:12:54.986 0-0/? E/q6asm_callback: payload size of 8 is less than expected.
2020-10-16 10:12:55.351 1568-4304/? E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
2020-10-16 10:13:52.588 4309-4309/? E/libnfc_nci: [ERROR:NativeNfcTag.cpp(866)] nativeNfcTag_doDisconnect: tag already deactivated
2020-10-16 10:13:52.571 0-0/? E/i2c-msm-v2 c1b6000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:7) mode:FIFO slv_addr:0x28 MSTR_STS:0x0d1300c8 OPER:0x00000090

我的问题已通过@RickSanchez 的建议解决,但我不得不在 AOSP 中添加两个库,其他库由@RickSanchez 在下面给出的 make 文件中

推荐答案

创建一个名为 OpenVPN 的文件夹,将名为 OpenVPN.apk 的 APK 放在里面,下面是 Android.mk:

Make a folder named OpenVPN , put APK named OpenVPN.apk inside and the Android.mk below:

LOCAL_PATH := $(call my-dir)

my_archs := arm x86 arm64
my_src_arch := $(call get-prebuilt-src-arch, $(my_archs))

include $(CLEAR_VARS)
LOCAL_MODULE := OpenVPN
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_TAGS := optional
LOCAL_BUILT_MODULE_STEM := package.apk
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := OpenVPN.apk

LOCAL_PREBUILT_JNI_LIBS :=
  @lib/arm64-v8a/libc++_shared.so
  @lib/arm64-v8a/libconceal.so
  @lib/arm64-v8a/libfb.so
  @lib/arm64-v8a/libfolly_futures.so
  @lib/arm64-v8a/libfolly_json.so
  @lib/arm64-v8a/libglog.so
  @lib/arm64-v8a/libglog_init.so
  @lib/arm64-v8a/libhermes-executor-debug.so
  @lib/arm64-v8a/libhermes-executor-release.so
  @lib/arm64-v8a/libhermes-inspector.so
  @lib/arm64-v8a/libhttpcli.so
  @lib/arm64-v8a/libimagepipeline.so
  @lib/arm64-v8a/libjsc.so
  @lib/arm64-v8a/libjscexecutor.so
  @lib/arm64-v8a/libjsijniprofiler.so
  @lib/arm64-v8a/libjsinspector.so
  @lib/arm64-v8a/libnative-filters.so
  @lib/arm64-v8a/libnative-imagetranscoder.so
  @lib/arm64-v8a/libovpncli.so
  @lib/arm64-v8a/libreactnativeblob.so
  @lib/arm64-v8a/libreactnativejni.so
  @lib/arm64-v8a/libyoga.so

LOCAL_MODULE_TARGET_ARCH := $(my_src_arch)

include $(BUILD_PREBUILT)

提示:我用这个工具自动生成Android.mk:https://github.com/northbright/genandroidmk

Tip: I used this tool to generate the Android.mk automatically: https://github.com/northbright/genandroidmk

如果由于某种原因这不起作用,则将 APK 中的库解压缩到本地文件夹中,并使用相对路径(在 LOCAL_PREBUILT_JNI_LIBS 中不带@"签名,但只有 lib/arm64-v8a/libc++_shared.so )

If that doesn't work for some reason, then unzip the libs from the APK into a local folder, and refer to the libs using relative path ( in LOCAL_PREBUILT_JNI_LIBS without the "@" sign, but only lib/arm64-v8a/libc++_shared.so )

这篇关于在 AOSP 崩溃中添加预构建的 Apk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-18 13:42