Volley仍在logcat中打印日志,但未禁用。我尝试使用proguard-rules.pro但它仍然显示日志。 在这下面我添加proguard-rules.pro文件。
-dontwarn **
-target 1.7
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!code/allocation/variable
-keep class **
-keepclassmembers class *{*;}
-keepattributes *
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int v(...);
public static int i(...);
public static int w(...);
public static int d(...);
public static int e(...);
}
-assumenosideeffects class java.io.PrintStream {
public void println(%);
public void println(**);
}
它在logcat中输出如下所示的内容
I/System.out: open:http:...
I/System.out: [CDS][DNS] getAllByNameImpl netId = 0
D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=4; ai_family=0
D/libc-netbsd: [getaddrinfo]: hostname=simplifiedcoding.16mb.com; servname=(null); cache_mode=(null), netid=0; mark=0
D/libc-netbsd: [getaddrinfo]: hostname=simplifiedcoding.16mb.com; servname=(null); cache_mode=(null), netid=0; mark=0
D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/FrameworkListener: dispatchCommand data = (getaddrinfo simplifiedcoding.16mb.com ^ 1024 0 1 0 0)
D/libc-netbsd: [getaddrinfo]: hostname=simplifiedcoding.16mb.com; servname=(null); cache_mode=local, netid=109; mark=917613
D/libc-netbsd: [getaddrinfo]: ai_addrlen=0; ai_canonname=(null); ai_flags=1024; ai_family=0
D/libc-netbsd: default dns: query_ipv6=1, query_ipv4=1
D/libc-netbsd: res_queryN name = simplifiedcoding.16mb.com, class = 1, type = 28
D/libc-netbsd: res_queryN name = simplifiedcoding.16mb.com, class = 1, type = 1
D/libc-netbsd: res_queryN name = simplifiedcoding.16mb.com succeed
D/SocketClient: SocketClient sendData done: 222
D/SocketClient: SocketClient sendData done:
D/SocketClient: SocketClient sendData done:
建议我,如果你有任何好的解决方案
答案 0 :(得分:0)
你有没有在你的gradle中提到这个
buildTypes {
release {
minifyEnabled true
debuggable false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
}
}
如果您默认设置了
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
仅添加此文件
答案 1 :(得分:0)
在发布和调试模式下检查VolleyLog.DEBUG
的值。并尝试设置VolleyLog.DEBUG = BuildConfig.DEBUG
。 BuildConfig
类是您的主要应用程序包。