Android混淆规则介绍 您所在的位置:网站首页 jni混淆 Android混淆规则介绍

Android混淆规则介绍

2023-03-25 00:37| 来源: 网络整理| 查看: 265

Android混淆规则介绍

写在前面的话

APP上线推广,免不得是需要混淆加固的,况且劳动成果不易又会有谁希望自己的APP被破解抄袭呢。鉴于此方显本片文章的通用型和重要意义。

混淆简介

Android代码混淆是一种应用源代码保护技术,用来防止别人对apk进行逆向分析;从Android2.3开始,Google就在SDK中加入了ProGuard的工具,使用它来进行代码的混淆。

ProGuard是一个压缩、优化和混淆Java字节码文件的免费工具, 其作用有以下几点:

删除代码中的注释; 删除代码中没有用到的类、字段、方法和属性; 会把代码中的包名、类名、方法名,变量名等修改为abcd…这种没有意义的名字,使得反编译出来的代 码难以阅读,从而达到防止apk被破解和逆向分析的目的; 经过ProGuard混淆后,apk安装包会变小;

在实际项目中,有些Java类不能进行混淆,需要配置混淆规则;

在实际项目中,打包apk时一般都需要进行混淆处理;

混淆后会生成mapping.txt文件,该文件需要存档以便用来还原和查看混淆后的出错日志;

1. 开启混淆并配置混淆规则的位置

在项目的build.gradle文件中打开混淆的开关,然后在proguard-rules.pro文件中添加混淆规则即可

buildTypes { debug { //是否进行混淆 minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } release { //开启混淆只需要设置为true即可 minifyEnabled true //添加混淆规则的位置 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } 2. 找到上衣步骤配置的混淆文件,在里面添加混淆规则

首先介绍一下添加混淆规则中常用到的一些命令的含义,方便我们理解并能够自行添加属于我们项目中的一些混淆规则,然后再介绍一下项目中一些通用的混淆规则。

2.1 混淆规则常用到的命令含义

保留该包下的类名不会被混淆,但是该包的子包的类名还是会被混淆

-keep class pageName.*

保留该包及其子包的类名不会被混淆

-keep class pageName.**

保留类名及其该类的内容不会被混淆(包括变量名,方法名等)

-keep class pageName.* {*;}

不保留类名只保留该类的方法名、变量名等不会被混淆

-keepclassmembers class pageName.*{*;}

保留所有继承某类的子类不会被混淆(implement同理)

-keep public class * extends android.app.Activity

保留该内部类中所有的public方法名、变量名不会被混淆

-keepclassmembers class pageName$内部类名 { //"$"的含义是保留某类的内部类不会被混淆 public *; }

、、的含义和使用

; //匹配所有的构造器 ; //匹配所有的域 ; //匹配所有的方法 //可以在以上的命令前加上public、private、native等来进一步指定不被混淆的内容 //也可以在以上的命令后面加上参数,来指定含有特定的参数构造方法或者方法名不会被混淆 -keep class pageName { public ; //保留所有的public的构造方法不会被混淆 } -keep class pageName { public (java.lang.String); //保留所有的public的构造方法并且参数是String对象,不会被混淆 } -keep class pageName { //保留所有的private的方法名不会被混淆 private ; }

含有Keep关键字的含义(移除是指在压缩时(Shrinking)是否会被删除,需要开启压缩)

保留 防止被移除或者被重命名 防止被重命名 类和类成员 -keep -keepnames 仅类成员 -keepclassmembers -keepclassmembernames 如果拥有某成员,保留类和类成员 -keepclasseswithmembers -keepclasseswithmembernames

2.2 通用的一些混淆规则

注:四大组件、Fragment、自定义控件不需要添加混淆规则,因为这些默认是不会被混淆的,所以网上很多四大组件的混淆规则是没必要添加的。

注解

-keepattributes *Annotation*

R文件下面的资源

-keep class **.R$* {*;}

本地的native方法(JNI)

-keepclasseswithmembernames class * { native ; }

反射(该pageName是被反射类的包名)

-keep class pageName{*;}

JavaBean中的泛型

-keepattributes Signature

JavaBean(如果使用了Gson进行解析Json字符串,就需要添加JavaBean的混淆规则,因为Gson使用了反射的原理)

-keep class pageName** -keep class pageName**{*;}

枚举

# 保留枚举类不被混淆 -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); }

Parcelable序列化和Creator静态成员变量

-keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; }

Serializable序列化

-keepclassmembers class * implements java.io.Serializable { static final long serialVersionUID; private static final java.io.ObjectStreamField[] serialPersistentFields; !static !transient ; !private ; !private ; private void writeObject(java.io.ObjectOutputStream); private void readObject(java.io.ObjectInputStream); java.lang.Object writeReplace(); java.lang.Object readResolve(); }

WebView

-keepclassmembers class fqcn.of.javascript.interface.for.webview { public *; } -keepclassmembers class * extends android.webkit.webViewClient { public void *(android.webkit.WebView, java.lang.String, android.graphics.Bitmap); public boolean *(android.webkit.WebView, java.lang.String); } -keepclassmembers class * extends android.webkit.webViewClient { public void *(android.webkit.webView, jav.lang.String); }

与JS交互

#Android4.2以上需要添加以下的两个混淆配置 -keepattributes *Annotation* -keepattributes *JavascriptInterface* -keepclassmembers class pageName$内部类名 { public *; }

第三方的Jar包、依赖、SDK等

这个就需要查看项目中添加了那些第三方的Jar包、依赖、SDK了,然后在其官网上或者Github找相应的混淆规则,一般都会有的,如果没有可以自己写混淆规则。根据上面介绍的一些常用的命令含义,一般都能满足自己写混淆规则了。

3. ProGuard作用

压缩(Shrinking):默认开启,用以减小应用体积,移除未被使用的类和成员,并且会在优化动作执行之后再次执行(因为优化后可能会再次暴露一些未被使用的类和成员)。

-dontshrink 关闭压缩

优化(Optimization):默认开启,在字节码级别执行优化,让应用运行的更快。

-dontoptimize 关闭优化 -optimizationpasses n 表示proguard对代码进行迭代优化的次数,Android一般为5

混淆(Obfuscation):默认开启,增大反编译难度,类和类成员会被随机命名,除非用keep保护。

-dontobfuscate 关闭混淆

混淆后默认会在工程目录app/build/outputs/mapping/release下生成一个mapping.txt文件,这就是混淆规则,我们可以根据这个文件把混淆后的代码反推回源本的代码,所以这个文件很重要,注意保护好。原则上,代码混淆后越乱越无规律越好,但有些地方我们是要避免混淆的,否则程序运行就会出错 。

4. 常见问题

报错 Note: the configuration explicitly specifies '**' to keep library class ***.

ote: the configuration keeps the entry point 'retrofit.OkHttpCall$ExceptionCatchingRequestBody$1 { long read(okio.Buffer,long); }', but not the descriptor class 'okio.Buffer' Note: the configuration keeps the entry point 'retrofit.RequestBuilder { void canonicalize(okio.Buffer,java.lang.String,int,int,boolean); }', but not the descriptor class 'okio.Buffer' Note: the configuration keeps the entry point 'retrofit.RequestBuilder$ContentTypeOverridingRequestBody { void writeTo(okio.BufferedSink); }', but not the descriptor class 'okio.BufferedSink' Note: the configuration keeps the entry point 'retrofit.RxJavaCallAdapterFactory$CallOnSubscribe { void call(rx.Subscriber); }', but not the descriptor class 'rx.Subscriber' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.Buffer' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.BufferOverflowException' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.BufferUnderflowException' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.ByteBuffer' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.ByteOrder' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.CharBuffer' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.DoubleBuffer' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.FloatBuffer' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.IntBuffer' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.LongBuffer' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.MappedByteBuffer' Note: the configuration explicitly specifies 'java.nio.*' to keep library class 'java.nio.ShortBuffer' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.ConnectionReuseStrategy' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.Header' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HeaderElement' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HeaderIterator' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpClientConnection' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpConnection' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpEntity' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpEntityEnclosingRequest' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpException' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpHost' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpInetConnection' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpMessage' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpRequest' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpRequestInterceptor' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpResponse' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpResponseInterceptor' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.HttpVersion' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.NameValuePair' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.NoHttpResponseException' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.ProtocolException' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.ProtocolVersion' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.RequestLine' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.StatusLine' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.auth.AuthScheme' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.auth.AuthSchemeRegistry' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.auth.AuthScope' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.auth.AuthState' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.auth.Credentials' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.auth.UsernamePasswordCredentials' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.AuthenticationHandler' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.CircularRedirectException' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.ClientProtocolException' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.CookieStore' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.CredentialsProvider' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.HttpClient' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.HttpRequestRetryHandler' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.HttpResponseException' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.RedirectException' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.RedirectHandler' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.RequestDirector' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.ResponseHandler' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.UserTokenHandler' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.entity.UrlEncodedFormEntity' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.clienthods.AbortableHttpRequest' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.clienthods.HttpDelete' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.clienthods.HttpEntityEnclosingRequestBase' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.clienthods.HttpGet' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.clienthods.HttpHead' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.clienthods.HttpPost' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.clienthods.HttpPut' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.clienthods.HttpRequestBase' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.clienthods.HttpUriRequest' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.utils.URIUtils' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.client.utils.URLEncodedUtils' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ClientConnectionManager' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ClientConnectionOperator' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ClientConnectionRequest' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ConnectionKeepAliveStrategy' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ConnectionReleaseTrigger' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ManagedClientConnection' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.params.ConnManagerPNames' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.params.ConnManagerParams' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.params.ConnPerRoute' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.params.ConnPerRouteBean' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.routing.HttpRoute' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.routing.HttpRoutePlanner' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.routing.RouteInfo' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.scheme.HostNameResolver' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.scheme.LayeredSocketFactory' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.scheme.PlainSocketFactory' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.scheme.Scheme' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.scheme.SchemeRegistry' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.scheme.SocketFactory' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ssl.AbstractVerifier' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ssl.BrowserCompatHostnameVerifier' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ssl.SSLSocketFactory' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.conn.ssl.X509HostnameVerifier' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.cookie.ClientCookie' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.cookie.Cookie' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.cookie.CookieSpecRegistry' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.cookie.SetCookie' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.entity.AbstractHttpEntity' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.entity.HttpEntityWrapper' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.entity.StringEntity' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.auth.AuthSchemeBase' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.auth.BasicScheme' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.auth.RFC2617Scheme' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.client.AbstractHttpClient' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.client.DefaultHttpClient' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.client.DefaultRedirectHandler' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.client.RedirectLocations' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.conn.tsccm.AbstractConnPool' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.conn.tsccm.RefQueueHandler' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.impl.cookie.BasicClientCookie' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.message.AbstractHttpMessage' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.message.BasicHeader' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.message.BasicNameValuePair' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.message.HeaderGroup' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.params.AbstractHttpParams' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.params.BasicHttpParams' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.params.CoreConnectionPNames' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.params.CoreProtocolPNames' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.params.HttpConnectionParams' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.params.HttpParams' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.params.HttpProtocolParams' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.protocol.BasicHttpContext' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.protocol.BasicHttpProcessor' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.protocol.HttpContext' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.protocol.HttpProcessor' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.protocol.HttpRequestExecutor' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.protocol.HttpRequestInterceptorList' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.protocol.HttpResponseInterceptorList' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.protocol.SyncBasicHttpContext' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.util.ByteArrayBuffer' Note: the configuration explicitly specifies 'org.apache.http.**' to keep library class 'org.apache.http.util.CharArrayBuffer' Note: there were 21 references to unknown classes. You should check your configuration for typos. (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass) Note: there were 1 references to unknown class members. You should check your configuration for typos. Note: there were 1027 unkept descriptor classes in kept class members. You should consider explicitly keeping the mentioned classes (using '-keep'). (http://proguard.sourceforge.net/manual/troubleshooting.html#descriptorclass) Note: there were 128 library classes explicitly being kept. You don't need to keep library classes; they are already left unchanged. (http://proguard.sourceforge.net/manual/troubleshooting.html#libraryclass) Note: there were 65 unresolved dynamic references to classes or interfaces. You should check if you need to specify additional program jars. (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass) Warning: there were 412 unresolved references to classes or interfaces. You may need to add missing library jars or update their versions. If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass) Warning: there were 6 unresolved references to program class members. Your input classes appear to be inconsistent. You may need to recompile the code. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember) Warning: there were 2 unresolved references to library class members. You probably need to update the library versions. Alternatively, you may have to specify the option '-dontskipnonpubliclibraryclassmembers'. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember) Warning: Exception while processing task java.io.IOException: Please correct the above warnings first. :app:transformClassesAndResourcesWithProguardForRelease FAILED FAILURE: Build failed with an exception.

运行打包后控制台提示报错日志,大抵就是项目中引用了未知的类,建议添加’org.apache.http.**'和’java.nio.*'到混淆文件中,keep.完美解决

请在忽略文件中添加如下信息,内容要使用日志报错提示相应替换包名

很有可能报错依旧,请在确认已经按照日志提示的内容完全配置忽略文件规则了,可以使用下面的这句代码压制报错

代码如下

-ignorewarnings -keep class * { public private *; }


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有