问:为什么写?
答:网上搜出来的都试过了,不行!下面直接上代码和注意事项!
首先到这个目录(/RK3568/Rockchip_Android13_SDK_Release/device/rockchip/rk356x/tl3568_evm/preinstall)下创建SogouIME文件夹,在SogouIME中添加如下内容
1.apk从哪里来的?网上随便下载的
2.Android.mk内容如下,lib/arm64-v8a/里面的内容不用照搬,因为你跟我下的搜狗的app肯定不是一个版本的,自己想办法把自己那版的so文件写上去
XML
LOCAL_PATH := $(my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := SogouIME
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_PATH := $(TARGET_OUT_ODM)/bundled_persist-app
LOCAL_REPLACE_PREBUILT_APK_INSTALLED := $(LOCAL_PATH)/SogouIME.apk
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_DEX_PREOPT := false
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_JNI_SHARED_LIBRARIES_ABI := arm64-v8a
MY_LOCAL_PREBUILT_JNI_LIBS := \
lib/arm64-v8a/libaffinity.so \
lib/arm64-v8a/libc++_shared.so \
lib/arm64-v8a/libcrash_collect.so \
lib/arm64-v8a/libCtaApiLib.so \
lib/arm64-v8a/libframesequence.so \
lib/arm64-v8a/libframesequence_doutu.so \
lib/arm64-v8a/libkoom-java.so \
lib/arm64-v8a/libkwai-linker.so \
lib/arm64-v8a/liblogan.so \
lib/arm64-v8a/libluajava.so \
lib/arm64-v8a/libmarsxlog.so \
lib/arm64-v8a/libmmkv.so \
lib/arm64-v8a/libnative-sec.so \
lib/arm64-v8a/libopus_v1.so \
lib/arm64-v8a/libostar.so \
lib/arm64-v8a/libqmp.so \
lib/arm64-v8a/libSGMtlgShell.so \
lib/arm64-v8a/libsimple_vad.so \
lib/arm64-v8a/libsimplevadwrapper.so \
lib/arm64-v8a/libsogou_speex_nt_v01.so \
lib/arm64-v8a/libSogouAgc_v1.so \
lib/arm64-v8a/libsogouupdcore.so \
lib/arm64-v8a/libtgpalite.so \
lib/arm64-v8a/libtrace-canary.so \
lib/arm64-v8a/libvivo_account_wave.so \
lib/arm64-v8a/libweibosdkcore.so \
lib/arm64-v8a/libwind.so \
lib/arm64-v8a/libxgVipSecurity.so \
lib/arm64-v8a/libxhook_lib.so
MY_APP_LIB_PATH := $(TARGET_OUT_ODM)/bundled_persist-app/$(LOCAL_MODULE)/lib/$(LOCAL_JNI_SHARED_LIBRARIES_ABI)
# Ensure that the target lib64 directory exists before copying files
LOCAL_POST_INSTALL_CMD := \
mkdir -p $(TARGET_OUT)/lib64 && \
$(foreach lib, $(MY_LOCAL_PREBUILT_JNI_LIBS), \
cp -f $(LOCAL_PATH)/$(lib) $(TARGET_OUT)/lib64/$(notdir $(lib)); \
)
include $(BUILD_PREBUILT)
3.网上搜的那一圈缺的就是这个3,绝口不提需要创建lib这个目录是吧,绝口不提需要把apk解压出来的lib中的so文件放到这里面来
说一个成功的关键:相关的so文件是需要被复制到/system/lib64里面的,不然就算预装上了也运行不起会报错,代码如下
XML
LOCAL_POST_INSTALL_CMD := \
mkdir -p $(TARGET_OUT)/lib64 && \
$(foreach lib, $(MY_LOCAL_PREBUILT_JNI_LIBS), \
cp -f $(LOCAL_PATH)/$(lib) $(TARGET_OUT)/lib64/$(notdir $(lib)); \
)
最后,希望对你有所帮助。