Skip to content

PAINTROID-815 Crash at App Start - #1367

Open
harissabil wants to merge 1 commit into
Catrobat:developfrom
harissabil:fix-fragment-constructor-r8
Open

harissabil wants to merge 1 commit into
Catrobat:developfrom
harissabil:fix-fragment-constructor-r8

Conversation

@harissabil

@harissabil harissabil commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

Release builds crash on launch / app start after process death. Reproduce with Developer Options > "Don't keep activities", open the app, press Home, reopen.

androidx.fragment.app.g: Unable to instantiate fragment a.e: could not find Fragment constructor
Caused by: java.lang.NoSuchMethodException: a.e.<init> []

FragmentManager restores fragments reflectively through their no-arg constructor. R8 cannot see that call, so it removes the constructor. Confirmed with apkanalyzer that the constructor is missing from the release build.

R8 full mode became the default with the AGP 8 upgrade. release-2.13.0 built with AGP 7.2.1, does not crash.

a.e has not been retraced against the release mapping, so the exact fragment is not confirmed. PaintroidApplicationFragment is the most likely. The fix is a keep rule in app/proguard-rules.pro, using -keepclassmembers rather than -keep so class names stay obfuscated.

Tested with a minified release build; the rule no longer crashes with "Don't keep activities" option enabled.

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing unit tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Stick to the project’s gitflow workflow
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Post a message in the #paintroid Slack channel and ask for a code reviewer

@harissabil harissabil changed the title Fix crash on process death caused by R8 removing Fragment constructor PAINTROID-815 Crash at App Start Aug 10, 2026
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

Successfully merging this pull request may close these issues.

1 participant