Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在Android12版本的车机上出现的兼容性问题 #1365

Open
mutong05090501 opened this issue Jan 21, 2025 · 2 comments
Open

在Android12版本的车机上出现的兼容性问题 #1365

mutong05090501 opened this issue Jan 21, 2025 · 2 comments

Comments

@mutong05090501
Copy link

mutong05090501 commented Jan 21, 2025

大佬,请教下:
在某家车企的Android12版本的车机上启动插件会报错找不到com.tencent.shadow.sample.plugin.runtime.PluginDefaultProxyActivity,在宿主的manifest文件中也有正常注册,关键是在另一款Android11的车机和Android12的模拟器上启动插件就没有问题,很奇怪的一个报错。
使用shadow的demo也试了下,也是同样的在Android11的车机上正常启动插件,在Android12的车机上启动插件会报相同的错误,具体报错信息如下:
FATAL EXCEPTION: main
Process: com.kernelsoft.exampleapp119, PID: 19859
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.kernelsoft.exampleapp119/com.tencent.shadow.sample.plugin.runtime.PluginDefaultProxyActivity}: java.lang.ClassNotFoundException: Didn't find class "com.tencent.shadow.sample.plugin.runtime.PluginDefaultProxyActivity" on path: DexPathList[[zip file "/data/app/~~JjNcPsG65Y9BZxie_Hl_GQ==/com.kernelsoft.exampleapp119-9ODCBWiltcBlBjvJAgmf3Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~JjNcPsG65Y9BZxie_Hl_GQ==/com.kernelsoft.exampleapp119-9ODCBWiltcBlBjvJAgmf3Q==/lib/arm64, /data/app/~~JjNcPsG65Y9BZxie_Hl_GQ==/com.kernelsoft.exampleapp119-9ODCBWiltcBlBjvJAgmf3Q==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3613)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3864)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:297)
at android.app.ActivityThread.main(ActivityThread.java:7870)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1037)

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.tencent.shadow.sample.plugin.runtime.PluginDefaultProxyActivity" on path: DexPathList[[zip file "/data/app/~~JjNcPsG65Y9BZxie_Hl_GQ==/com.kernelsoft.exampleapp119-9ODCBWiltcBlBjvJAgmf3Q==/base.apk"],nativeLibraryDirectories=[/data/app/~~JjNcPsG65Y9BZxie_Hl_GQ==/com.kernelsoft.exampleapp119-9ODCBWiltcBlBjvJAgmf3Q==/lib/arm64, /data/app/~~JjNcPsG65Y9BZxie_Hl_GQ==/com.kernelsoft.exampleapp119-9ODCBWiltcBlBjvJAgmf3Q==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:218)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
at android.app.Instrumentation.newActivity(Instrumentation.java:1285)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3600)
... 12 more

目前的一个思路就是这款车机的类加载机制可能魔改的比较多,出现了兼容性问题

@shifujun
Copy link
Collaborator

你可以尝试去掉dynamic runtime。它是利用反射修改classloader私有字段实现动态的。主要目的是为了减少引入到宿主的方法数增量。runtime中的那些代理壳子activity本身更新需求不大,不做成动态化更新的影响也不大。

去掉的意思就是把那部分直接打包到宿主里。

@mutong05090501
Copy link
Author

你可以尝试去掉dynamic runtime。它是利用反射修改classloader私有字段实现动态的。主要目的是为了减少引入到宿主的方法数增量。runtime中的那些代理壳子activity本身更新需求不大,不做成动态化更新的影响也不大。

去掉的意思就是把那部分直接打包到宿主里。

收到,感谢大佬,我尝试下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants