Skip to content

Add Keep annotations to kotlin plugin example #640

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

Closed
mahesh-hegde opened this issue Apr 30, 2023 · 4 comments · Fixed by dart-archive/jnigen#296
Closed

Add Keep annotations to kotlin plugin example #640

mahesh-hegde opened this issue Apr 30, 2023 · 4 comments · Fixed by dart-archive/jnigen#296

Comments

@mahesh-hegde
Copy link
Contributor

It crashes in release mode.

E/flutter (32388): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception in Java code called through JNI: java.lang.NoSuchMethodError: no non-static method "LExample;.thinkBeforeAnswering(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;"
E/flutter (32388):
E/flutter (32388): java.lang.NoSuchMethodError: no non-static method "LExample;.thinkBeforeAnswering(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;"
E/flutter (32388):
E/flutter (32388):
E/flutter (32388): #0      JniAccessorWrappers.throwException (package:jni/src/accessors.dart:116)
E/flutter (32388): dart-lang/jnigen#1      _check (package:jni/src/accessors.dart:16)
E/flutter (32388): dart-lang/jnigen#2      JniResultMethods.check (package:jni/src/accessors.dart:21)
E/flutter (32388): dart-lang/jnigen#3      JniResultMethods.object (package:jni/src/accessors.dart:59)
E/flutter (32388): dart-lang/jnigen#4      Example.thinkBeforeAnswering (package:kotlin_plugin/kotlin_bindings.dart:61)
<Redacted>
@mahesh-hegde
Copy link
Contributor Author

Edit: It has Keep but for some reason it's not being applied to the continuation. I am not completely familiar with the suspend fn implementation.

@mahesh-hegde
Copy link
Contributor Author

It requires -dontobfuscate flag in proguard rules, because proguard obfuscates private method names.

Realized when google search returned this question https://stackoverflow.com/questions/9651703/using-proguard-with-android-without-obfuscation.

@HosseinYousefi
Copy link
Member

Is this fixed now?

@mahesh-hegde
Copy link
Contributor Author

Nope I didn't do any code changes regarding this. You might try, and check if adding -dontobfuscate works. It worked for me.

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