Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACRA 5.9.0 crashes on release builds with R8 #1051

Closed
gmk57 opened this issue Apr 13, 2022 · 1 comment
Closed

ACRA 5.9.0 crashes on release builds with R8 #1051

gmk57 opened this issue Apr 13, 2022 · 1 comment

Comments

@gmk57
Copy link

gmk57 commented Apr 13, 2022

Describe the bug
The docs says that ACRA already ships with an optimal proguard configuration, but for 5.9.0 this doesn't seem to be true.
With typical configuration, with R8 enabled in release builds, it crashes at startup with something like (deobfuscated trace):

java.lang.RuntimeException: Unable to instantiate application gmk57.testacracrashing.App: java.lang.NoSuchMethodException: <init> [boolean, class java.lang.String, class java.lang.String, class java.lang.String, class org.acra.sender.HttpSender$Method, int, int, boolean, class java.lang.Class, class java.lang.String, class java.lang.Integer, class java.lang.String, boolean, interface java.util.List, interface java.util.Map, int, class l2.d]
    at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
    <...>
 Caused by: java.lang.NoSuchMethodException: <init> [boolean, class java.lang.String, class java.lang.String, class java.lang.String, class org.acra.sender.HttpSender$Method, int, int, boolean, class java.lang.Class, class java.lang.String, class java.lang.Integer, class java.lang.String, boolean, interface java.util.List, interface java.util.Map, int, class l2.d]
    at java.lang.Class.getConstructor0(Class.java:2204)
    at java.lang.Class.getConstructor(Class.java:1683)
    at org.acra.config.HttpSenderConfigurationBuilder.build(HttpSenderConfigurationBuilder.java:247)
    at org.acra.config.HttpSenderConfigurationKt.httpSender(HttpSenderConfiguration.kt:153)
    at gmk57.testacracrashing.App$attachBaseContext$1.invoke(App.java:20)
    at gmk57.testacracrashing.App$attachBaseContext$1.invoke(App.java:16)
    at org.acra.ktx.ExtensionsKt.initAcra(Extensions.kt:27)
    at gmk57.testacracrashing.App.attachBaseContext(App.kt:16)

ACRA 5.8.4 with the same config works fine, so seems to be a regression in 5.9.0.

Expected behavior
Add does not crash.

Version

  • Android: any (at least 7.1 - 12)
  • ACRA: 5.9.0
  • AGP: 7.0.4, 7.1.3

Steps to reproduce

  1. Checkout a sample app
  2. Build a release APK (for some reason it does not crash in debug builds, even with minifyEnabled true)
  3. Launch

Workaround
Add to proguard-rules.pro:
-keepclassmembers class org.acra.config.* { <init>(...); }
This line (or something more sophisticated) should probably be included in ACRA's default rules.

This is probably a duplicate of #1006, I don't know why that issue was closed.

BTW, thanks for the great library, it is very helpful. :)

@F43nd1r
Copy link
Member

F43nd1r commented Apr 13, 2022

Good catch, fixed in 5.9.1 👍

@F43nd1r F43nd1r closed this as completed Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants