-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
大神您好!
我们项目目前在使用多插件单进程这种场景。在使用过程中,出现运行时报databinding找不到标签错误:java.lang.RuntimeException: java.lang.IllegalArgumentException: View is not a binding layout. Tag: layout/layout_activity_skip2_0,目前不知道什么原因,所以求助与您。我用你提供的Demo复现出来了。
测试Demo地址:https://github.com/lilidejing/feature-shadow-test-databinding/tree/feature-shadow-test-databinding
demo测试,在project/sample/source/sample-plugin目录下一共有3个插件,分别是sample-app、sample-child、sample-base,还有一个公共库sample-base-lib。
复现步骤:
1,打包插件:打包插件时是打包的 sample-app插件,它里面有脚本会自动将上面3个插件打成一个zip插件包。
2,打包宿主:直接打包project/sample/source/sample-host项目即可
3,运行宿主,默认界面会选中sample-child,点击启动插件,进入界面即会崩溃报错。
sample-child的报错界面,里面有说明3种databinding使用方式和报错情况。第三种使用方式不会报错,但返回的databinding也为null:
https://github.com/lilidejing/feature-shadow-test-databinding/blob/feature-shadow-test-databinding/projects/sample/source/sample-plugin/sample-child/src/main/java/com/test/TestActivitySkip3.java
有一种情况,三种databinding使用方式都不会报错:
1,把sample-child的gradle文件下面两句代码注释掉: pluginCompileOnly project(":sample-base-lib") normalImplementation project(":sample-base-lib")
2,把 sample-app 的gradle文件中打包packagePlugin 脚本中的sampleChild {} 中的dependsOn = ['sample-base']注释掉
但是我们项目不能这么做,因为需要用到dependsOn这个属性
以上就是我提供的信息,抽空帮忙看下什么原因,谢谢!
最开始说的报错信息如下:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tencent.shadow.sample.host/com.tencent.shadow.sample.plugin.runtime.PluginDefaultProxyActivity}: java.lang.RuntimeException: java.lang.IllegalArgumentException: View is not a binding layout. Tag: layout/layout_activity_skip2_0
2025-09-04 17:01:59.026 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3432)
2025-09-04 17:01:59.027 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3596)
2025-09-04 17:01:59.027 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
2025-09-04 17:01:59.028 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
2025-09-04 17:01:59.028 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
2025-09-04 17:01:59.028 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2067)
2025-09-04 17:01:59.029 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.os.Handler.dispatchMessage(Handler.java:106)
2025-09-04 17:01:59.029 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.os.Looper.loop(Looper.java:223)
2025-09-04 17:01:59.030 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.ActivityThread.main(ActivityThread.java:7705)
2025-09-04 17:01:59.030 7380-7380 DEBUG com.tencent.shadow.sample.host E at java.lang.reflect.Method.invoke(Native Method)
2025-09-04 17:01:59.031 7380-7380 DEBUG com.tencent.shadow.sample.host E at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
2025-09-04 17:01:59.031 7380-7380 DEBUG com.tencent.shadow.sample.host E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
2025-09-04 17:01:59.031 7380-7380 DEBUG com.tencent.shadow.sample.host E Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: View is not a binding layout. Tag: layout/layout_activity_skip2_0
2025-09-04 17:01:59.032 7380-7380 DEBUG com.tencent.shadow.sample.host E at com.tencent.shadow.core.loader.delegates.ShadowActivityDelegate.onCreate(ShadowActivityDelegate.kt:159)
2025-09-04 17:01:59.032 7380-7380 DEBUG com.tencent.shadow.sample.host E at com.tencent.shadow.core.runtime.container.PluginContainerActivity.onCreate(PluginContainerActivity.java:84)
2025-09-04 17:01:59.033 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.Activity.performCreate(Activity.java:7994)
2025-09-04 17:01:59.033 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.Activity.performCreate(Activity.java:7978)
2025-09-04 17:01:59.034 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1310)
2025-09-04 17:01:59.034 7380-7380 DEBUG com.tencent.shadow.sample.host E at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3405)
2025-09-04 17:01:59.034 7380-7380 DEBUG com.tencent.shadow.sample.host E ... 11 more
2025-09-04 17:01:59.035 7380-7380 DEBUG com.tencent.shadow.sample.host E Caused by: java.lang.IllegalArgumentException: View is not a binding layout. Tag: layout/layout_activity_skip2_0
2025-09-04 17:01:59.035 7380-7380 DEBUG com.tencent.shadow.sample.host E at androidx.databinding.DataBindingUtil.bind(DataBindingUtil.java:185)
2025-09-04 17:01:59.036 7380-7380 DEBUG com.tencent.shadow.sample.host E at androidx.databinding.DataBindingUtil.bind(DataBindingUtil.java:152)
2025-09-04 17:01:59.036 7380-7380 DEBUG com.tencent.shadow.sample.host E at com.test.TestActivitySkip3.onCreate(TestActivitySkip3.java:41)
2025-09-04 17:01:59.036 7380-7380 DEBUG com.tencent.shadow.sample.host E at com.tencent.shadow.core.loader.delegates.ShadowActivityDelegate.onCreate(ShadowActivityDelegate.kt:156)
2025-09-04 17:01:59.037 7380-7380 DEBUG com.tencent.shadow.sample.host E ... 16 more
2025-09-04 17:01:59.037 7380-7380 DEBUG com.tencent.shadow.sample.host E Back traces ends.