I am using lasted version of Android Studio, and i have obfuscated my project by ProGuard in Android Studio
.
Content of Build.gradle
such as this:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
but when start the build project, an error like that see error
warning Image : see warning
How can I fix this?
The short answer
If you are completely sure that your app works as expected with other build types (debug), then suppress the warning by adding the following to your
proguard-rules.pro
file-dontwarn com.github.siyamed.shapeimageview.**
The long answer
The warning says that it can't find the referenced class
org.kxml2.io.KXmlParser
.KXmlParser
is only used in SvgToPath.java as illustrated below:I think that this results in one of two potential reasons for why it fails:
org.kxml2.io.KXmlParser
, so you would have to include it yourselfcom.github.siyamed.shapeimageview
ororg.kxml2.io.KXmlParser
by obfuscating their code.If you think Proguard is breaking your builds then consider the following
You can keep the classes (stopping them being obfuscated by Proguard) by adding the following to your
proguard-rules.pro
file:-keep class com.github.siyamed.shapeimageview.** { *; }
-keep interface com.github.siyamed.shapeimageview.** { *; }
-keep class org.kxml2.io.KXmlParser.** { *; }
-keep interface org.kxml2.io.KXmlParser.** { *; }