Android-image-cropper: Error when building with Proguard enabled

Created on 11 Mar 2017  路  6Comments  路  Source: ArthurHub/Android-Image-Cropper

Hello,

If Proguard is enabled, I have this error when I generate an APK :

[ERROR] [system.err] Warning: com.theartofdev.edmodo.cropper.CropImageActivity: can't find referenced field 'int cropImageView' in program class com.theartofdev.edmodo.cropper.R$id
...
[ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.

Can you tell me what is the problem?

Thank you

help wanted

Most helpful comment

I've just encountered this. Fixed this by adding -keep class com.theartofdev.edmodo.cropper.* to your proguard-rules.pro file:

All 6 comments

Did you figure this out?

Sadly no, I have disabled proguard for now but this is annoying :/

I am a only proguard amateur, but you could try:

-dontwarn com.theartofdev.edmodo.cropper.R$id

If you don't use the missing resources, or something like:

-keepclassmembers class com.theartofdev.edmodo.cropper.R$id {
    public static <fields>;
}

Not sure if the latter works.

Thank you @jmgirven. The -dontwarn rule looks to work. I don't really like to hide warning like this but the app runs fine :)

I don't have experience working with pro-guard so if someone knows what I need to add please let me know.

I've just encountered this. Fixed this by adding -keep class com.theartofdev.edmodo.cropper.* to your proguard-rules.pro file:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haoyd picture haoyd  路  5Comments

ben-j69 picture ben-j69  路  5Comments

jjimenez0611 picture jjimenez0611  路  4Comments

key321 picture key321  路  9Comments

danponce picture danponce  路  3Comments