Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
271 views
in Technique[技术] by (71.8m points)

android - How to use -dontwarn in ProGuard?

I am using android studio to build debug and release application. When i build debug/release application

./gradlew assembleDebug

./gradlew assembleRelease

both build are created perfectly and run as well. Shows appropriate dialog box for debug or release

now i have added proguard details in build.gradle:

signingConfigs {
    myConfig {
           storeFile file("keystore.jks")
           storePassword "abc123!"
           keyAlias "androidreleasekey"
           keyPassword "pqrs123!"
    }
}

buildTypes {
    release {
        runProguard true
        proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
        signingConfig signingConfigs.myConfig
    }
}
productFlavors {
    defaultFlavor {
        proguardFile 'proguard-rules.txt'
    }
}

Now it shows error in event log as

Warning: there were 7 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 2 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) :Flash Sales:proguardDefaultFlavorRelease FAILED

If i turn the runProguard option to false then its running.

I have these questions:

1) is it ok to release apk with runProguard = false?

2) How to use dontwarn while creating release build?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

When I add new lib to project Generally this How I need to define for Progaurd.

Let's say I am using Twitter4J lib then I add dontwarn this way.

-keep class twitter4j.** { *; }

-dontwarn twitter4j.**


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...