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

[PLAT-8394] Fix crash in minified Android builds #151

Merged
merged 2 commits into from
Apr 26, 2022

Conversation

nickdowell
Copy link
Contributor

@nickdowell nickdowell commented Apr 21, 2022

Goal

Fix a crash in Bugsnag when used in Android apps that are built for distribution, with the following log messages:

W/System.err(26556): java.lang.ClassNotFoundException: Didn't find class "com.bugsnag.android.App" on path: ...
W/System.err(26556): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)

Changeset

Adds a ProGuard rule (via UPL) to prevent com.bugsnag.** Java classes being obfuscated.

Makes the test fixture's gameActivityClassAdditions methods public so that they are not hidden by ProGuard.

Testing

Updates build files to produce Distribution (minified) and signed builds for example app & test fixture. This reproduces the crash and causes E2E testing to fail - e.g. https://buildkite.com/bugsnag/bugsnag-unreal/builds/1014

E2E tests pass with the fix in place.

Copy link
Contributor

@kattrali kattrali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine, saw maybe one spurious change?

@@ -21,14 +21,14 @@

<gameActivityClassAdditions>
<insert>
private void clearBugsnagCache() {
public void clearBugsnagCache() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProGuard seems to hide private methods, making them unaccessible from JNI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. So this is simpler than adding it to the app's proguard rules. Ok 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it seemed simpler to make these public than adding more proguard rules 🙃

@nickdowell nickdowell merged commit 7487f9e into next Apr 26, 2022
@nickdowell nickdowell deleted the nickdowell/proguard branch April 26, 2022 08:48
@nickdowell nickdowell mentioned this pull request Apr 26, 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

Successfully merging this pull request may close these issues.

None yet

2 participants