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

Add mandatory configurations for Notification Service extension on Android #171

Open
erdemyerebasmaz opened this issue Jun 20, 2024 · 0 comments · Fixed by #172
Open

Add mandatory configurations for Notification Service extension on Android #171

erdemyerebasmaz opened this issue Jun 20, 2024 · 0 comments · Fixed by #172
Assignees

Comments

@erdemyerebasmaz
Copy link
Contributor

Since Notification Service extension is bundled with Android package and

  • it uses kotlinx-serialization &
  • relies on JNA library

There are required steps to take for apps to compile & build properly on release mode, even if they do not use offline payments feature.

kotlinx-serialization

Starting with this 1.8.20 release, the Kotlin K2 compiler has a preview version of the serialization plugin. It's recommended for users to upgrade their Kotlin version to at least 1.8.20 or set up the serialization plugin on their projects explicitly with older versions.

JNA library

JNA relies on specific class and method names to load native libraries and access native code. If these names are obfuscated or removed, it can cause runtime errors and failures in native library loading.

To ensure proper functionality, a Proguard rules needs to be added to explicitly tell R8 compiler to keep certain parts of the JNA library. Here is an example of Proguard rules:

-dontwarn dalvik.system.VMStack
-dontwarn java.lang.**
-dontwarn javax.naming.**
-dontwarn sun.reflect.Reflection

# JNA
-keep class com.sun.jna.** { *; }
-keep class * implements com.sun.jna.** { *; }

# Other
-dontoptimize

These rules ensure that the JNA library's core components are not obfuscated, allowing the library to function correctly. See Shrink, obfuscate, and optimize your app for more information on how and where to add Proguard rules on your app.

@erdemyerebasmaz erdemyerebasmaz changed the title Add required migration steps for Notification Service extension on Android Add required configurations for Notification Service extension on Android/Flutter Jun 20, 2024
@erdemyerebasmaz erdemyerebasmaz changed the title Add required configurations for Notification Service extension on Android/Flutter Add mandatory configurations for Notification Service extension on Android Jun 20, 2024
@erdemyerebasmaz erdemyerebasmaz linked a pull request Jun 20, 2024 that will close this issue
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 a pull request may close this issue.

2 participants