tinker使用
1.从github上下载tinker的demo
tinker-sample-android github地址 https://github.com/Tencent/tinker.git
2.同步gradle
如果报错 Error:(28, 0) Cause: can't get git rev, you should add git to system path or just input test value, such as 'testTinkerId'
是提示你没有设置tinker的id。
解决方法:
1.给项目加一个git。
2.设置一个thinkerId,在下面代码上给一个thinkerID ,String gitRev = “testTinkerId”(id取值需谨慎,后面会介绍id的作用)
def gitSha() {
try {
String gitRev = 'git rev-parse --short HEAD'.execute(null, project.rootDir).text.trim()
if (gitRev == null) {
throw new GradleException("can't get git rev, you should add git to system path or just input test value, such as 'testTinkerId'")
}
return gitRev
} catch (Exception e)