在用腾讯的X5浏览器内核更换Android系统的WebView时,增加的SDK,混淆时报错
can't find referenced method 'int checkSelfPermission(java.lang.String)
现在越来越多的SDK开始兼容Android M,就会使用一些M里的新API,checkSelfPermission就是一个,如果本地环境没有配置成23,就会出混淆失败.错误类似下面:
Warning: u.aly.bt: can't find referenced method 'int checkSelfPermission(Java.lang.String)' in library class android.content.Context
Warning: there were 1 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.NET/manual/troubleshooting.html#unresolvedlibraryclassmember)
Exception while processing task
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:473)
at proguard.ProGuard.initialize(ProGuard.java:233)
at proguard.ProGuard.execute(ProGuard.java:98)
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
at com.android.builder.tasks.Job.runTask(Job.java:48)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
at java.lang.Thread.run(Thread.java:745)
其实知道原因之后解决就简单了,将本地编译环境改为23即可