tinkerpatch-easy-sample
tinkerpatch-easy-sample copied to clipboard
无法使用instant run
项目当前的热更新环境配置是正确的,已经发布上线。我设置tinkerpatchSupport{tinkerEnable = false},想禁用热更新,来使用instant run,发现不行,必须得把tinker的相关的依赖和代码全部注释才可以使用instant run,有简单点的配置来禁用tinkerpatch,而且还能够使用instant run 吗
可以参照如下示例: https://github.com/TinkerPatch/tinkerpatch-easy-sample/blob/master/app/src/main/java/com/tinkerpatch/easy_sample/SampleApplication.java#L80
不是这个问题,已经设置false了。
<application> <service android:name="com.tencent.tinker.lib.service.TinkerPatchService" android:exported="false" android:process=":patch" /> <service android:name="com.tencent.tinker.lib.service.TinkerPatchService$InnerService" android:exported="false" android:process=":patch" /> <service android:name="com.tencent.tinker.lib.service.DefaultTinkerResultService" android:exported="false" /> </application>
应该是android:process="xxx"属性影响到了instant run,一直提示有多个进程在运行,需要重启app。BuildConfig.TINKER_ENABLE,我直接用false替换,还是不行。
Instant Run applied code changes and restarted the app.The app was restarted since it uses multiple processes.配置TinkerPatch后一直提示这个,TINKER_ENABLE = fasle,设置这个也不行,注释TinkerPatch相关的所有代码才可以使用Instant Run
Instant Run applied code changes and restarted the app.The app was restarted since it uses multiple processes.
这不是看起来已经生效了么?
这个会导致app重启,我想直接在当前界面刷新的效果。
multiple processes,会导致app重启,感觉instant run会检查AndroidManifest.xml里面有没有android:process这个属性,如果有会重启,如果没有就可以直接刷新当前界面,而不是重启,这是我测试后的感想。我另外开了一个项目,测试后得到的结果。
@jasonlee3652 确实如此,instant run对于多进程的app都会默认重启来保证所有进程都是最新的代码。
可以在外面再包一层,类似https://github.com/Tencent/tinker/blob/master/tinker-sample-android/app/build.gradle