解决 Chrome 预装运行报错 crashing because cannot load libchrome.so

简介: 解决 Chrome 预装运行报错 crashing because cannot load libchrome.so

问题描述


将 Chrome 预装到 system/app 目录下,打开 Chrome 直接闪退了,直觉告诉我应该是少so库导致的


将Chrome直接install上去,再次打开 Chrome 正常进入,将 data/data/ Chrome 目录拷贝出来,


找到其中需要的so库


错误日志


com.android.chrome I/cr_Linker: Using linker: org.chromium.base.library_loader.LegacyLinker
com.android.chrome I/cr_LibraryLoader: Loading chrome
com.android.chrome I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:0
com.android.chrome E/GoogleCertificates: Failed to get Google certificates from remote
    tw: No acceptable module found. Local version is 0 and remote version is 0.
        at zw.a(PG:29)
        at dw.b(PG:6)
        at dw.a(PG:6)
        at ur.a(PG:23)
        at el.a(PG:6)
        at sA0.a(PG:3)
        at Sm.e(PG:3)
        at Sm.b(PG:1)
        at org.chromium.components.signin.AccountManagerFacade.d(PG:2)
        at l42.a(PG:3)
        at H40.call(PG:4)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at X40.run(PG:1)
        at e50.g(PG:11)
        at d50.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at P40.run(PG:2)
        at java.lang.Thread.run(Thread.java:764)
com.android.chrome W/GooglePlayServicesUtil: Google Play Store is missing.
 W/Layer: [Splash Screen com.android.chrome#0] opaque layer with plane alpha:0.86 cannot be handled by hwcomposer
 W/Layer: [Splash Screen com.android.chrome#0] opaque layer with plane alpha:0.94 cannot be handled by hwcomposer
com.android.chrome E/cr_LegacyLinker: Unable to load library: libchrome.so
com.android.chrome W/cr_LibraryLoader: Failed to load native library with shared RELRO, retrying without
com.android.chrome E/cr_LegacyLinker: Unable to load library: libchrome.so
com.android.chrome I/SurfaceFactory: [static] sSurfaceFactory = com.mediatek.view.impl.SurfaceFactoryImpl@228b644
com.android.chrome E/cr_CompositorSurfaceMgr: Transitioning to surface with format : -1
    --------- beginning of crash
com.android.chrome E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.android.chrome, PID: 2445
    c30: errorCode=4
        at xT0.b(PG:8)
        at cU0.a(PG:3)
        at rT0.a(PG:18)
        at nT0.run(PG:2)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6523)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)

解决办法


根据拷贝出的Chrome文件,so库路径为 lib/arm, 在编译的Android.mk目录下,新建 lib/arm ,

将对应的so拷贝进去,新建 copy.sh

#!/bin/bash
echo -e "SO_PATH=${1}"
echo -e "OUT_PACKAGE_PATH=${2}"
echo -e "start cp ${1} so..."
currentPath=$(pwd)/${1}
destinationPath=${OUT}/${2}/lib
echo -e "currentPath=${currentPath}"
echo -e "destinationPath=${destinationPath}"
if [ ! -d "${destinationPath}" ]; then
    echo "mkdie destinationPath"
    mkdir -p ${destinationPath}
fi
cp -f -r $currentPath $destinationPath 
echo -e "\n copy.sh make done...."


在 Android.mk 中调用执行 copy.sh

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# Module name should match apk name to be installed
LOCAL_MODULE := Chrome
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
$(info ${LOCAL_PATH})
$(info ${TARGET_OUT})
SO_PATH := $(LOCAL_PATH)/lib/arm
OUT_PACKAGE_PATH := system/app/$(LOCAL_MODULE)
__PRODUCT_COPY_SO = $(shell  ${LOCAL_PATH}/copy.sh  ${SO_PATH} ${OUT_PACKAGE_PATH})
$(info ${__PRODUCT_COPY_SO})


参考文章


Android chrome浏览器的定制

Chrome crashing because cannot load libchrome.so #21

目录
相关文章
|
6月前
|
Web App开发 存储 Linux
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
445 0
|
6月前
|
Web App开发 Python
Python使用selenium的Chrome下载文件报错解决
Python使用selenium的Chrome下载文件报错解决
229 0
|
6月前
|
Web App开发 前端开发 JavaScript
控制台出现报错DevTools failed to load source map: Could not load content for chrome-extension://的原因及解决方案
控制台出现报错DevTools failed to load source map: Could not load content for chrome-extension://的原因及解决方案
344 0
控制台出现报错DevTools failed to load source map: Could not load content for chrome-extension://的原因及解决方案
|
4月前
|
Web App开发 前端开发
canvas保存图片时,谷歌浏览器Chrome报错【解决方案】Not allowed to navigate top frame to data URL
canvas保存图片时,谷歌浏览器Chrome报错【解决方案】Not allowed to navigate top frame to data URL
134 0
|
6月前
|
Web App开发 Java Serverless
Serverless 应用引擎操作报错合集之阿里函数计算中,使用自定义运行时部署程序时,发现Chrome层已经建立但运行程序仍然缺失如何解决
Serverless 应用引擎(SAE)是阿里云提供的Serverless PaaS平台,支持Spring Cloud、Dubbo、HSF等主流微服务框架,简化应用的部署、运维和弹性伸缩。在使用SAE过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
|
Web App开发
Chrome谷歌浏览器F12打开控制台报错
Chrome谷歌浏览器F12打开控制台报错
557 0
|
Web App开发
Python+Selenium 自动化-指定chrome驱动运行selenium实例演示,运行指定位置下的浏览器驱动
Python+Selenium 自动化-指定chrome驱动运行selenium实例演示,运行指定位置下的浏览器驱动
522 0
Python+Selenium 自动化-指定chrome驱动运行selenium实例演示,运行指定位置下的浏览器驱动
|
Web App开发 内存技术
允许chrome浏览器运行flash
允许chrome浏览器运行flash
145 0
允许chrome浏览器运行flash
|
Web App开发 数据采集 iOS开发
一日一技:Selenium如何接管已经运行的Chrome浏览器?
一日一技:Selenium如何接管已经运行的Chrome浏览器?
1161 0
一日一技:Selenium如何接管已经运行的Chrome浏览器?
|
Web App开发 算法 安全
Android 12 将允许运行 5 个 Chrome 实例;Furion v3.0.0.rc 发布 | 思否周刊
Android 12 将允许运行 5 个 Chrome 实例;Furion v3.0.0.rc 发布 | 思否周刊
146 0
Android 12 将允许运行 5 个 Chrome 实例;Furion v3.0.0.rc 发布 | 思否周刊