You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.插件配置的依赖如下:
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
宿主加载时转换异常:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.stujr.rphost/com.stujr.rphost.PluginFragmentActivity}: java.lang.ClassCastException: class com.stujr.rpplugin2.TestFragment cannot be cast to androidx.fragment.app.Fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3335)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3484)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2068)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7551)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
Caused by: java.lang.ClassCastException: class com.stujr.rpplugin2.TestFragment cannot be cast to androidx.fragment.app.Fragment
at java.lang.Class.asSubclass(Class.java:2482)
at com.stujr.rphost.PluginFragmentActivity.onCreate(PluginFragmentActivity.java:25)
at android.app.Activity.performCreate(Activity.java:7893)
at android.app.Activity.performCreate(Activity.java:7880)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3310)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3484)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2068)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7551)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
2022-11-28 17:40:20.878 6636-6636/? I/Process: Sending signal. PID: 6636 SIG:
compileOnly 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
(尝试过用compileOnly,但是项目使用的是appcompat,所以activity 的样式需要以依赖material,才能编译打包,而且如下方式打包 编译报错
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not resolve androidx.appcompat:appcompat:1.3.0.
Required by:
project :app
> Cannot find a version of 'androidx.appcompat:appcompat' that satisfies the version constraints:
Dependency path 'RPPlugin2:app:unspecified' --> 'androidx.appcompat:appcompat:1.3.0'
Constraint path 'RPPlugin2:app:unspecified' --> 'androidx.appcompat:appcompat:{strictly 1.2.0}' because of the following reason: debugRuntimeClasspath uses version 1.2.0
Dependency path 'RPPlugin2:app:unspecified' --> 'com.google.android.material:material:1.4.0' --> 'androidx.appcompat:appcompat:1.1.0'
Dependency path 'RPPlugin2:app:unspecified' --> 'com.google.android.material:material:1.4.0' --> 'androidx.constraintlayout:constraintlayout:2.0.1' --> 'androidx.appcompat:appcompat:1.2.0'
)
问题详细描述 Detailed description of the problem
加载插件Fragment转换异常(插件fragment继承androidx.fragment.app.Fragment)
复现问题步骤 Steps to reproduce the problem
1.插件配置的依赖如下:
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
宿主加载时转换异常:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.stujr.rphost/com.stujr.rphost.PluginFragmentActivity}: java.lang.ClassCastException: class com.stujr.rpplugin2.TestFragment cannot be cast to androidx.fragment.app.Fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3335)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3484)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2068)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7551)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
Caused by: java.lang.ClassCastException: class com.stujr.rpplugin2.TestFragment cannot be cast to androidx.fragment.app.Fragment
at java.lang.Class.asSubclass(Class.java:2482)
at com.stujr.rphost.PluginFragmentActivity.onCreate(PluginFragmentActivity.java:25)
at android.app.Activity.performCreate(Activity.java:7893)
at android.app.Activity.performCreate(Activity.java:7880)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3310)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3484)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
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:2068)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7551)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:995)
2022-11-28 17:40:20.878 6636-6636/? I/Process: Sending signal. PID: 6636 SIG:
implementation 'com.google.android.material:material:1.4.0'
(尝试过用compileOnly,但是项目使用的是appcompat,所以activity 的样式需要以依赖material,才能编译打包,而且如下方式打包 编译报错
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
其它重要信息 Other important information
replugin-host-lib/gradle Version:3.0.0
rePlugin-plugin-lib/gradle Version:3.0.0
Android API Version:
Android 手机型号&ROM(Phone model & ROM):
Logcat上下文 Logcat context
The text was updated successfully, but these errors were encountered: