java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
10-10 10:02:08.308 24318-24318/com.didi.virtualapk E/CrashCommonHandler: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.didi.virtualapk/com.didi.virtualapk.core.A$1}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2194)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2243)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5011)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:832)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:648)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:354)
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:323)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.didi.virtualapk.demo.aidl.BookManagerActivity.onCreate(BookManagerActivity.java:96)
at android.app.Activity.performCreate(Activity.java:5244)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at com.didi.virtualapk.internal.VAInstrumentation.callActivityOnCreate(VAInstrumentation.java:156)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2158)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2243)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5011)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:832)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:648)
at dalvik.system.NativeStart.main(Native Method)
10-10 10:02:08.398 24363-24363/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.didi.virtualapk, PID: 24363
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.didi.virtualapk/com.didi.virtualapk.core.A$1}: android.content.ActivityNotFoundException: error intent: #Intent;component=com.didi.virtualapk/.core.A%241;B.isPlugin=true;S.target.package=com.didi.virtualapk.demo;S.target.activity=com.didi.virtualapk.demo.aidl.BookManagerActivity;end
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2120)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2243)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5011)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:832)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:648)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.ActivityNotFoundException: error intent: #Intent;component=com.didi.virtualapk/.core.A%241;B.isPlugin=true;S.target.package=com.didi.virtualapk.demo;S.target.activity=com.didi.virtualapk.demo.aidl.BookManagerActivity;end
at com.didi.virtualapk.internal.VAInstrumentation.newActivity(VAInstrumentation.java:129)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2111)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2243)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5011)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:832)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:648)
at dalvik.system.NativeStart.main(Native Method)
点击加载插件按钮的时候出现的问题。
插件用的是项目中的demo,使用assemblePlugin的方式进行编译,然后放到指定目录下
但是出现了这个问题!?
在插件项目中修改主题为Theme.AppCompat没有用处。不知道在哪里填写。
看了提问必看:特补充:
core version implementation 'com.didi.virtualapk:core:0.9.8'
问题机型,系统版本 行车记录仪上面的设备(车载设备),Android api 为19
完整log:如上
复现步骤:运行宿主应用,点击加载插件按钮。
gradle version: gradle 4.4
android gradle plugin version: classpath 'com.android.tools.build:gradle:3.0.0' 也试过 classpath 'com.android.tools.build:gradle:3.1.4'
VirtualAPK plugin version: classpath 'com.didi.virtualapk:gradle:0.9.8.6'
OS type: windows 10
项目升到0.9.8后遇到同样问题 请问解决了吗 插件同样是assemblePlugin方式编译出来的
请问怎么解决的
请问插件ID你这里设置的是什么 之前遇到这个问题的原因是插件的ID为 0x02-0x0F,修改为从0x10开始的值,解决了
还是一直报 Caused by: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
还是一直报 Caused by: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
我遇到过类似问题,我当时的情况是processResources task没有执行(被认为up-to-date)了,导致VA的Hooker没有执行,Plugin的资源id没有被正确的处理。
我给processResources配置了onlyIf { true }和outputs.upToDateWhen { false }后问题得到了解决。
不知道你遇到的是否属于同类问题,不妨试试。
您好,请问解决了吗?我也遇到了这个问题,如果解决了,请帮帮忙,谢谢了
我使用的项目中的工程,在demo工程中,使用命令行: .\gradlew clean assemblePlugin 注意:gradle文件中 targetHost = '../../VirtualAPK/app' 如果路径错误,编译时会有错误提示; 编译成功后就可以在这里:VirtualAPK\PluginDemo\app\build\outputs\plugin\beijingRelease 找到apk,再把apk名字改为Test.apk;放到宿主app的Asset文件夹下或发送到测试机的sd卡根目录下即可跳转成功了。
也可以在右侧gradle下 PluginDemo/:app/build/assemblePlugin 双击来执行;不过targetHost 要改变一下:targetHost = '../../app'
还有另外一种解决方法,通过源码依赖virtualapk,在VAInstrumentation.java的182行加入
activity.setTheme(activityInfo.theme);