Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.8k views
in Technique[技术] by (71.8m points)

android - Adding Pre-built Apk in AOSP crashes

  • AOSP 10

  • OpenVPN official App

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.

Here are adb logs of app crash

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 

My problem is solved by @RickSanchez suggestion but I had to add two libraries in AOSP other given below make file by @RickSanchez

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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)

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

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 )


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...