Reputation: 49
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?
Upvotes: 0
Views: 1167
Reputation:
proguard-rules.pro
file-dontwarn com.github.siyamed.shapeimageview.**
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:
import org.kxml2.io.KXmlParser;
...
public class SvgToPath {
...
private static PathInfo parse(InputStream in, boolean ignoreDefs, float dpi) {
try {
XmlPullParser xr = new KXmlParser();
...
} catch (Exception e) {
Log.w(TAG, "Parse error: " + e);
throw new RuntimeException(e);
}
}
...
}
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
or org.kxml2.io.KXmlParser
by obfuscating their code.At the end of the day the libraries that you and most people use are nearly always open source. Obfuscating open source code provides no benefit as any potential attacker could just look up the source code online.
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.** { *; }
Upvotes: 8