didi / VirtualAPK

A powerful and lightweight plugin framework for Android
Apache License 2.0
8.98k stars 1.52k forks source link

Android9.0 插件资源加载失败,打开纯代码布局的Activity就就行,但是一旦使用资源则崩溃 #318

Open KollerWithDoris opened 5 years ago

KollerWithDoris commented 5 years ago
  1. Version com.didi.virtualapk:core:0.9.8
  2. 问题机型 小米9 MIUI10.2 系统版本 android9.0
  3. 完整log 05-31 23:31:06.858 17764-17764/com.didi.virtualapk E/AndroidRuntime: FATAL EXCEPTION: main Process: com.didi.virtualapk, PID: 17764 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.didi.virtualapk/com.didi.virtualapk.core.A$1}: android.view.InflateException: Binary XML file line #32: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x101005a a=-1} at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2946) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3081) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:201) at android.app.ActivityThread.main(ActivityThread.java:6815) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873) Caused by: android.view.InflateException: Binary XML file line #32: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x101005a a=-1} Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 1: TypedValue{t=0x2/d=0x101005a a=-1} at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:777) at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:7762) at android.view.ViewGroup$MarginLayoutParams.(ViewGroup.java:7953) at android.widget.LinearLayout$LayoutParams.(LinearLayout.java:1997) at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1895) at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:87) at android.view.LayoutInflater.rInflate(LayoutInflater.java:869) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828) at android.view.LayoutInflater.inflate(LayoutInflater.java:519) at android.view.LayoutInflater.inflate(LayoutInflater.java:427) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:1895) at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2607) at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2680) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:410) at android.app.Activity.setContentView(Activity.java:2824) at com.huanju.chajiandemo.TestActivityTwo.onCreate(TestActivityTwo.java:23) at android.app.Activity.performCreate(Activity.java:7210) at android.app.Activity.performCreate(Activity.java:7201) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272) at com.didi.virtualapk.internal.VAInstrumentation.callActivityOnCreate(VAInstrumentation.java:156) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2926) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3081) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1831) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:201) at android.app.ActivityThread.main(ActivityThread.java:6815) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
  4. 复现步骤 点击demo中的加载插件Activity(带资源型)即崩溃,因手头无其他版本测试机,不知道是不是仅出现在android9.0版本
mdoufei commented 5 years ago

看起来和我的问题类似,https://github.com/didi/VirtualAPK/issues/343

lhkzx007 commented 4 years ago

@mdoufei 有解决吗?我也是这样的问题

lhkzx007 commented 4 years ago

@mdoufei 我的问题解决了, 资源命名冲突了, 宿主和插件里边的一个属性命名相同,改掉一个就好了