magicbaby810 / HotfixFlutter

使用Tinker或Sophix实现Flutter热更新,兼容flutterboost
400 stars 51 forks source link

大佬好,我这边打出补丁后native代码改动生效,但是flutter代码无效,从哪里入手分析可以知道问题出在哪 #5

Open HotSummerJuly opened 4 years ago

HotSummerJuly commented 4 years ago

我是直接使用的tinker,tinker 依赖库的版本是1.9.14.6,插件的版本是1.9.9,插桩库是您最新的版本。 我检查了打包出来的补丁,里面存在lib\armeabi-v7a\libapp.so

magicbaby810 commented 4 years ago

我是直接使用的tinker,tinker 依赖库的版本是1.9.14.6,插件的版本是1.9.9,插桩库是您最新的版本。 我检查了打包出来的补丁,里面存在lib\armeabi-v7a\libapp.so

看下log控制台是否有 is use tinker 和 flutter patch is loaded successfully 这两个log?

magicbaby810 commented 4 years ago
9881-9881/? I/Tinker: find FlutterMain
9881-9881/? I/Tinker: cpu abi is:arm64-v8a
9881-9881/? I/Tinker: flutterPatchInit() called   true true
9881-9881/? I/Tinker: findLibraryFromTinker success:/data/user/0/com.sk.hotfixflutter/tinker/patch-e279f9dc/lib/lib/arm64-v8a/libapp.so
9881-9881/? I/Tinker: flutter patch is loaded successfully

我试了下可以的,这是加载成功的日志,你对照下

HotSummerJuly commented 4 years ago

2020-08-11 09:06:52.307 24468-24468/? I/Tinker: find FlutterMain 2020-08-11 09:06:52.307 24468-24468/? I/Tinker: cpu abi is:arm64-v8a 2020-08-11 09:06:52.307 24468-24468/? I/Tinker: flutterPatchInit() called true true 2020-08-11 09:06:52.307 24468-24468/? I/Tinker: flutter patch is loaded successfully

少了一行日志... 我去检查下

magicbaby810 commented 4 years ago

hannibal是1.0.7吗? 1.0.7忘记上传了,你检查下再试试

HotSummerJuly commented 4 years ago

hannibal是1.0.7吗? 1.0.7忘记上传了,你检查下再试试

1.0.5.1 ,这个有影响吗?那我换成1.0.7试试

magicbaby810 commented 4 years ago

hannibal是1.0.7吗? 1.0.7忘记上传了,你检查下再试试

1.0.5.1 ,这个有影响吗?那我换成1.0.7试试

用最新的

HotSummerJuly commented 4 years ago
2020-08-11 14:30:06.050 12856-12856/? I/Tinker.TinkerLoader: tryLoadPatchFiles: load end, ok!
2020-08-11 14:30:06.081 12856-12856/? I/Tinker.TinkerLoadResult: oh yeah, tinker load all success
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: find FlutterMain
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: lib path is null

日志打印出来是这样

magicbaby810 commented 4 years ago
2020-08-11 14:30:06.050 12856-12856/? I/Tinker.TinkerLoader: tryLoadPatchFiles: load end, ok!
2020-08-11 14:30:06.081 12856-12856/? I/Tinker.TinkerLoadResult: oh yeah, tinker load all success
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: find FlutterMain
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: lib path is null

日志打印出来是这样

这样的log你看下FlutterPatch类,是因为没找到Tinker初始化的地方,isUseTinker是false,如果找到的话,会打印 is use tinker

/**
     * Sophix 插桩方法,获取项目是否使用Tinker
     *
     * 此方法不可修改,否则不会成功
     */
    public static void hookIsUseTinker() {
        isUseTinker = true;
        TinkerLog.i(TAG, "is use tinker");
    }

你先要确认hannibal是1.0.7再确认是否初始化了Tinker

HotSummerJuly commented 4 years ago
2020-08-11 14:30:06.050 12856-12856/? I/Tinker.TinkerLoader: tryLoadPatchFiles: load end, ok!
2020-08-11 14:30:06.081 12856-12856/? I/Tinker.TinkerLoadResult: oh yeah, tinker load all success
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: find FlutterMain
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: lib path is null

日志打印出来是这样

这样的log你看下FlutterPatch类,是因为没找到Tinker初始化的地方,isUseTinker是false,如果找到的话,会打印 is use tinker

/**
     * Sophix 插桩方法,获取项目是否使用Tinker
     *
     * 此方法不可修改,否则不会成功
     */
    public static void hookIsUseTinker() {
        isUseTinker = true;
        TinkerLog.i(TAG, "is use tinker");
    }

你先要确认hannibal是1.0.7再确认是否初始化了Tinker

是的 版本是最新的并且tinker也初始化了,如果没有初始化的话 native的补丁应该应用不上去的吧,测试native的代码改动生效 classpath 'com.sk.hannibal:hannibal:1.0.7' implementation 'com.sk.flutterpatch:flutterpatch:0.0.5.1'

magicbaby810 commented 4 years ago
2020-08-11 14:30:06.050 12856-12856/? I/Tinker.TinkerLoader: tryLoadPatchFiles: load end, ok!
2020-08-11 14:30:06.081 12856-12856/? I/Tinker.TinkerLoadResult: oh yeah, tinker load all success
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: find FlutterMain
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: lib path is null

日志打印出来是这样

这样的log你看下FlutterPatch类,是因为没找到Tinker初始化的地方,isUseTinker是false,如果找到的话,会打印 is use tinker

/**
     * Sophix 插桩方法,获取项目是否使用Tinker
     *
     * 此方法不可修改,否则不会成功
     */
    public static void hookIsUseTinker() {
        isUseTinker = true;
        TinkerLog.i(TAG, "is use tinker");
    }

你先要确认hannibal是1.0.7再确认是否初始化了Tinker

是的 版本是最新的并且tinker也初始化了,如果没有初始化的话 native的补丁应该应用不上去的吧,测试native的代码改动生效

classpath 'com.sk.hannibal:hannibal:1.0.7'

implementation 'com.sk.flutterpatch:flutterpatch:0.0.5.1'

哥们,给个联系方式,沟通下

HotSummerJuly commented 4 years ago
2020-08-11 14:30:06.050 12856-12856/? I/Tinker.TinkerLoader: tryLoadPatchFiles: load end, ok!
2020-08-11 14:30:06.081 12856-12856/? I/Tinker.TinkerLoadResult: oh yeah, tinker load all success
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: find FlutterMain
2020-08-11 14:30:06.407 12856-12856/? I/Tinker: lib path is null

日志打印出来是这样

这样的log你看下FlutterPatch类,是因为没找到Tinker初始化的地方,isUseTinker是false,如果找到的话,会打印 is use tinker

/**
     * Sophix 插桩方法,获取项目是否使用Tinker
     *
     * 此方法不可修改,否则不会成功
     */
    public static void hookIsUseTinker() {
        isUseTinker = true;
        TinkerLog.i(TAG, "is use tinker");
    }

你先要确认hannibal是1.0.7再确认是否初始化了Tinker

是的 版本是最新的并且tinker也初始化了,如果没有初始化的话 native的补丁应该应用不上去的吧,测试native的代码改动生效 classpath 'com.sk.hannibal:hannibal:1.0.7' implementation 'com.sk.flutterpatch:flutterpatch:0.0.5.1'

哥们,给个联系方式,沟通下

我的微信号是hotsummerjuly

Elex92 commented 3 years ago

遇到同样的问题,请指教。更新补丁只有原生代码的改动生效了,flutter改动的代码没有生效

Elex92 commented 3 years ago
2020-12-08 16:09:28.472 27676-27676/? I/Tinker.IncrementCompMgr: package has no incremental component meta, skip init.
2020-12-08 16:09:28.472 27676-27676/? I/Tinker.TinkerLoader: tryLoadPatchFiles: load end, `ok!`
2020-12-08 16:09:28.472 27676-27676/? D/Tinker.DefaultAppLike: onBaseContextAttached:
2020-12-08 16:09:28.474 27676-27676/? W/Tinker.TinkerInternals: setSafeModeCount: preferName:tinker_own_config_com.sk.hotfixflutter count:0
2020-12-08 16:09:28.474 27676-27676/? I/Tinker.ReflectApp: with app realApplication from manifest applicationName:com.sk.hotfixflutter.AppApplication
2020-12-08 16:09:28.476 27676-27676/? I/Tinker: is use tinker
2020-12-08 16:09:28.477 27676-27676/? I/Tinker.TinkerPatchListener: application maxMemory:384 #

这是日志

heroghost commented 3 years ago

我掐指一算,可能是你的flutter版本比期望版本高

st1994 commented 3 years ago
9881-9881/? I/Tinker: find FlutterMain
9881-9881/? I/Tinker: cpu abi is:arm64-v8a
9881-9881/? I/Tinker: flutterPatchInit() called   true true
9881-9881/? I/Tinker: findLibraryFromTinker success:/data/user/0/com.sk.hotfixflutter/tinker/patch-e279f9dc/lib/lib/arm64-v8a/libapp.so
9881-9881/? I/Tinker: flutter patch is loaded successfully

我试了下可以的,这是加载成功的日志,你对照下

我的也有原生代码生效,flutter失效的情况,但是这些日志都有,2021-03-17 14:59:49.329 17068-17068/? I/Tinker: flutter patch is loaded successfully,是不是flutter和boost的版本有要求?目前是'v1.22.4-hotfixes'

magicbaby810 commented 3 years ago
9881-9881/? I/Tinker: find FlutterMain
9881-9881/? I/Tinker: cpu abi is:arm64-v8a
9881-9881/? I/Tinker: flutterPatchInit() called   true true
9881-9881/? I/Tinker: findLibraryFromTinker success:/data/user/0/com.sk.hotfixflutter/tinker/patch-e279f9dc/lib/lib/arm64-v8a/libapp.so
9881-9881/? I/Tinker: flutter patch is loaded successfully

我试了下可以的,这是加载成功的日志,你对照下

我的也有原生代码生效,flutter失效的情况,但是这些日志都有,2021-03-17 14:59:49.329 17068-17068/? I/Tinker: flutter patch is loaded successfully,是不是flutter和boost的版本有要求?目前是'v1.22.4-hotfixes'

新版本的boost有问题,不支持

tommyhh commented 3 years ago

我也是用用flutter + boost v1.22.4-hotfixes 这个,原生代码生效,flutter失效,请问新版本的boost的问题有方法可以解决么?

magicbaby810 commented 3 years ago

我也是用用flutter + boost v1.22.4-hotfixes 这个,原生代码生效,flutter失效,请问新版本的boost的问题有方法可以解决么

boost不兼容好,我怎么给你解决啊,等boost出新版本把

chengxushi commented 3 years ago
9881-9881/? I/Tinker: find FlutterMain
9881-9881/? I/Tinker: cpu abi is:arm64-v8a
9881-9881/? I/Tinker: flutterPatchInit() called   true true
9881-9881/? I/Tinker: findLibraryFromTinker success:/data/user/0/com.sk.hotfixflutter/tinker/patch-e279f9dc/lib/lib/arm64-v8a/libapp.so
9881-9881/? I/Tinker: flutter patch is loaded successfully

我试了下可以的,这是加载成功的日志,你对照下

你好, 请问一下, 我按照readme配置了之后, 在补丁包里有看到更新的libapp.so文件和在assets文件夹中看到新加的图片, 热更新安卓代码生效, 但Flutter的代码无效, 而且我没有上面的日志, 请问是怎么回事? 我的配置是: classpath 'com.github.magicbaby810:hannibal:1.0.9'

tinker版本: implementation 'com.tencent.tinker:tinker-android-lib:1.9.9'

magicbaby810 commented 3 years ago
9881-9881/? I/Tinker: find FlutterMain
9881-9881/? I/Tinker: cpu abi is:arm64-v8a
9881-9881/? I/Tinker: flutterPatchInit() called   true true
9881-9881/? I/Tinker: findLibraryFromTinker success:/data/user/0/com.sk.hotfixflutter/tinker/patch-e279f9dc/lib/lib/arm64-v8a/libapp.so
9881-9881/? I/Tinker: flutter patch is loaded successfully

我试了下可以的,这是加载成功的日志,你对照下

你好, 请问一下, 我按照readme配置了之后, 在补丁包里有看到更新的libapp.so文件和在assets文件夹中看到新加的图片, 热更新安卓代码生效, 但Flutter的代码无效, 而且我没有上面的日志, 请问是怎么回事? 我的配置是: classpath 'com.github.magicbaby810:hannibal:1.0.9'

tinker版本: implementation 'com.tencent.tinker:tinker-android-lib:1.9.9'

来麻花疼 1151212481