Repository navigation
preserve native classes from R8 minification and add dynamic minification to debug build - #797
Conversation
|
just noting it here, |
|
I will take look into this. I have a few suggestions so that we can prevent such issues from happening again. |
angrezichatterbox
left a comment
There was a problem hiding this comment.
Here could we have a try error to catch this error maybe. This would make sure that we the autosuggestion native modules don't cause crashes if they don't get added. We would also have to catch it at other places as well I suppose. This would make it full proof over long term.
We could also have a check on this on such cases.
The only issue with doing this we wouldn't know that the app has certain issues.
@andrewtavis is there any way we could add sentry like bug reports for open source app without invading user privacy. This could be on the longer term however just thought of bringing it up.
|
Just checking though that if the autosuggestion native modules aren't being added, then we might need to look into alternatives? And re Sentry: I'm not 100% opposed to adding anything that would help the development community maintain the apps, but we'd need to discuss user privacy for sure. Sentry is at the very least GDPR compliant, but we'd definitely need a privacy policy update. Let's see if we can get through this current issue and then how the stability is after that. Then we can continue this conversation then as people see a need :) |
They would be added now. The native files that were required where being removed from the release build unless we state not to to minify the application. The suggestion I made there was to make sure that such native required instead of crashing the app would just fall back to the db or autosuggestions not working instead of causing crash which kills the experiance a bit for users. |
Ah yes, ok :) I guess that we should be able to get notified if things aren't working properly from an eventual user base and we want to make sure that we don't have the app breaking on people who we don't have a connection to, so could be something that we add in to make sure that we don't have random crashes killing the user experience. |
one more thing we could explore down the line would be integrations using Firebase Crashlytics and BigQuery to track crash diagnostics and stack traces in detail. User details can be completely anonymized (which is what I do on the other app I maintain—the free tier covers about 60 days of retention before expiring), and it gives visibility into uncaught exceptions in production without storing personal data. we might have to look at the privacy angle as well once! |
…gning config for release
87a9c3f to
5be6a93
Compare
|
@angrezichatterbox, feel free to merge this in once it's at a state that you're happy with it :) Sounds like you two have been discussing this a fair amount, so merge away once you both are ok with the fix 😊 |
|
updated and added the native fallbacks that @angrezichatterbox mentioned |
|
|
||
| - ProGuard keep rules were added for JNI-bound classes and methods, preventing crashes in release builds ([#796](https://github.com/scribe-org/Scribe-Android/issues/796)). | ||
| - ProGuard keep rules and defensive fallbacks in NativeSuggestionEngine were added for JNI-bound classes and methods, preventing crashes in release builds ([#796](https://github.com/scribe-org/Scribe-Android/issues/796)). | ||
|
|
There was a problem hiding this comment.
Appreciate the attention to detail in adding in the space here :)
There was a problem hiding this comment.
do let me know if there are any other changes required @andrewtavis
There was a problem hiding this comment.
I'll let @angrezichatterbox give the final word on this one, but to me this all looks great!
| signingConfig = | ||
| if (keystorePropertiesFile.exists()) { | ||
| signingConfigs.getByName("release") | ||
| } else { | ||
| signingConfigs.getByName("debug") | ||
| } | ||
| } |
There was a problem hiding this comment.
@angrezichatterbox, i had specifically kept this, as without this fallback installRelease fails for anyone who doesn't have the release keystore, so contributors can't test release builds
There was a problem hiding this comment.
if you want me to remove it here, the dummy keystore generation would anyways need to be done in the smoke test in #800
only thing would be that contributors won't be able to test release builds locally
There was a problem hiding this comment.
Could we maybe look into a better way to do this. Instead of doing it with the release build. We could have minified debug builds created maybe.
There was a problem hiding this comment.
Ideally CI/CD pipelines should fail when the keystore values aren't present if we move to a proper pipeline
There was a problem hiding this comment.
Can we have a debug build have a propertiy minify instead where we can pass it as a flag. How does that sound. Open to a discussion on this
There was a problem hiding this comment.
hmm that makes sense as well, i've implemented separate minifiedDebug build rn here and in #800 but if you want me to clean this up and implement debug with the minify flag as well i can!
There was a problem hiding this comment.
Could you clean it up maybe so that we can just pass a flag to the debug build to get a minified version
There was a problem hiding this comment.
have integrated dynamic minification to the debug build through the flag
now supports
./gradlew assembleKeyboardsDebug -Pminify (or -Pminify=true)
./gradlew installKeyboardsDebug -Pminify (or -Pminify=true)
andrewtavis
left a comment
There was a problem hiding this comment.
praise: Thanks for the PR and quick reaction to the issue, @ashb155! Also appreciate the detailed review, @angrezichatterbox! Based on the discussion here it sounds like this is good enough to bring in. Changes have also at least been glanced at by @Roniscend as they're also in #800. Any further changes are welcome in a new PR!
Contributor checklist
./gradlew lintKotlin detekt testcommand as directed in the testing section of the contributing guideDescription
Fixes the crash (
UnsatisfiedLinkErrorinProximityInfo.setProximityInfoNative) occurring in closed testing release builds.R8 code shrinking in release builds was stripping JNI classes (like
BinaryDictionaryUtils), causingJNI_OnLoadin C++ to fail (-1) and abort loadinglibjni_latinime.so.app/proguard-rules.pro: Added keep rules forbe.scri.inputmethod.**andbe.scri.latin.**so R8 does not strip JNI classes (BinaryDictionaryUtils,BinaryDictionary, etc.) that are registered at runtime viaJNI_OnLoad.app/build.gradle.kts: Added a fallback to thedebugsigning key ifkeystore.propertiesis absent, allowing local testing of release builds on emulators via.\gradlew installKeyboardsRelease.Related issue