Closed hej2010 closed 10 months ago
In other words, gradle 8 is not supported OOTB by the Parse SDK, is that correct?
In other words, gradle 8 is not supported OOTB by the Parse SDK, is that correct?
Yes (if you are using minifyEnabled).
Pre gradle 8 minify would work, right?
Yes, everything worked until I updated to Gradle 8
Thanks for clarifying, do you have an idea how to fix it? Would you want to open a PR?
I fixed it by adding
-keep @com.parse.ParseClassName class com.parse.*
to proguard-rules.pro, then it no longer crashes.
I´m not sure which file in this project to add it to, maybe https://github.com/parse-community/Parse-SDK-Android/blob/master/parse/release-proguard.pro
@azlekov, any idea how we could fix this?
No clue, @mtrezza. I will check upcoming days. Maybe is related with latest version of AGP and R8.
Experiencing this as well. Proposed fix did not resolve it for us. Any ideas?
Same issue after upgrading Gradle to version 8. The proposed fix worked for me.
Like @hej2010 I do not have any custom subclasses registered and minifyEnabled true
for release build.
Currently experiencing this. Proposed fix did not resolve it for us. We've custom subclasses registered.
@tSquaredd Did you find a fix?
@SOGAPPS we ended up adding this to our proguard rules
-keepclassmembers public class * extends com.parse.** {
public <init>(...);
}
Thanks @tSquaredd
Using this worked for us - both "keep" & "keepclassmembers".
We added the two lines of code below to our apps "proguard-rules.pro" file.
-keep @com.parse.ParseClassName class com.parse.*
-keepclassmembers public class * extends com.parse.** { public <init>(...); }
Gradle 8.0 switches to using R8 in "full mode" by default: https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md#r8-full-mode "R8 performs more aggressive optimizations, meaning additional ProGuard configuration rules may be required."
It can be disabled by adding android.enableR8.fullMode=false
to gradle.properties
Does this comment already provide the solution?
@SOGAPPS In your comment did you mean one has to replace ParseClassName
with the custom classes a developer is using in their app?
@mtrezza
No, for clarity, we added the two lines of code below to our apps "proguard-rules.pro" file.
Doing this resolved our issue.
-keep @com.parse.ParseClassName class com.parse.*
-keepclassmembers public class * extends com.parse.** { public <init>(...); }
@azlekov do you think a PR with these lines could fix this issue?
I will compare and adjust mine in few days.
🎉 This change has been released in version 4.2.1
New Issue Checklist
Issue Description
The app crashes when initializing Parse with the latest Gradle/Android Studio version when using Proguard/R8 with
minifyEnabled true
and'com.android.tools.build:gradle:8.0.0'
.Steps to reproduce
Initialize Parse at app startup with
Parse.initialize(new Parse.Configuration.Builder(...));
Actual Outcome
The app crashes.
Expected Outcome
The app does not crash.
Environment
Parse Android SDK
4.2.0
Android 12
Logs
I do not have any custom subclasses registered.
Fixed by
Keeping all classes that are registered in
registerParseSubclasses()
by adding the line-keep @com.parse.ParseClassName class com.parse.*
toproguard-rules.pro
.