tinker第1部-集成

来源:互联网 发布:听新闻软件 编辑:程序博客网 时间:2024/05/02 04:53

之前写了一篇博客,bugly的补丁升级,有提到tinker,接下里会写一个tinker系列,算是深入tinker的学习过程。
这是我修改后的tinker源码地址,是从Tinker官方源码fork而来,为了方便阅读代码,增加了一些注释,后续有修改会不断提交,你可以watch我的fork

集成文件参考tinker接入文档

直接在AS上运行这个项目,等待build结束,需要注意一下几点

1.所有的操作都是在下图的gradle命令
这里写图片描述
如果你按照正常的这里写图片描述, run这个app会报错Plugin with id ‘com.tencent.tinker.patch’ not found.

2.既然第一步不能使用run,所以你安装apk,就只能使用adb install或者手机助手,[install组下面的installBug没有试过,有兴趣可以试试]

3.集成tinker不能使用debug模式调试,只能使用log调试。

4.在load patch的时候,注意我下面的代码

//有外置sdcard的时候获取的是/storage/sdcard1                String absolutePath = Environment.getExternalStorageDirectory().getAbsolutePath();                Log.e(TAG, "absolutePath:" + absolutePath);                String s = absolutePath + "/patch_signed_7zip.apk";                Log.e(TAG, "fullPath:" + s);                TinkerInstaller.onReceiveUpgradePatch(getApplicationContext(), s);

5.gradle不要升级到新的,我因为升级到gradle 就报了一个错,所以后来我还是保持它原来的gradle版本编译。

上面几点就是我在集成tinker时碰到的几个问题,后面会补全tinker系列。

原创粉丝点击