[英]Timber package doesn't exist Error when generating signed apk and proguard is activated
I'm trying to generate a signed apk with android studio, it gives me these errors 我正在尝试使用android studio生成签名的apk,它给了我这些错误
Error:(59, 18) error: package timber.log does not exist
Error:(27, 23) error: package okhttp3.logging does not exist
in my application class I define Timber as follow 在我的应用程序类中,我将Timber定义如下
if (BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
} else {
Timber.plant(new CrashReportingTree());
}
and this is the Okhttp logging method I use: 这是我使用的Okhttp记录方法:
public static HttpLoggingInterceptor loggingInterceptor() {
return new HttpLoggingInterceptor().setLevel(BuildConfig.DEBUG ? HttpLoggingInterceptor.Level.BODY :HttpLoggingInterceptor.Level.NONE);
}
gradle setup as follow: gradle设置如下:
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
and there is no specific proguard configurations. 而且没有特定的proguard配置。 what could be wrong?
有什么问题吗?
So I found the problem that causing this issue, in build.gradle app module file I was choosing the debugCompile
instead of the regular compile
so instead of 所以我发现了导致此问题的问题,在build.gradle应用程序模块文件中,我选择了
debugCompile
而不是常规compile
因此
debugCompile "com.jakewharton.timber:timber:$TIMBER_VERSION"
I should use this line 我应该用这条线
compile "com.jakewharton.timber:timber:$TIMBER_VERSION"
and the same for okhttp3:logging-interceptor
, after correcting the previous lines, and writing some proguard rules, I've generated the signed apk. 和
okhttp3:logging-interceptor
,在更正了前几行并编写了一些proguard规则之后,我生成了已签名的apk。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.