-
Notifications
You must be signed in to change notification settings - Fork 143
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
[question] [v.0.13.1] [android] getting IncompatibleClassChangeError when trying to bind .aar in C# project [SOLVED by adding ProGuard rules] #716
Comments
Hm, that doesn't look right. @dodikk thank you for notifying, although we don't support C# at the moment, but let's try to find a workaround. Do I understand correctly, that the sample project doesn't have the same issue? Right now, I do not have meaningful suggestions yet, but I do have a set of experiments that might help to locate the issue. Quick ideas to try on the "real" project
Please try using Themis 0.13.1 from JCenter directly (just indicate More experiments trying to find the difference between sample project and real project
|
Right. |
Actually, I've installed the package like this.
P.S. I had some difficulties integrating |
That sample project might have some failed experiments "leftovers".
|
Will come back with this a bit later today. |
@vixentael thanks for blazing fast reply. I appreciate a lot. |
Hm... Can this be because Another idea is that the method name may be not correct. JNI has some peculiar rules, especially when it comes to overloads. It seems correct – |
Thanks @ilammy . I've thought about that. But I did not have enough time to fork |
That same data from the "real project" does not break my "sample project". /cc @vixentael |
/cc @vixentael |
@vixentael @ilammy can that be caused by mismatch of the |
Same results on [UPD] same results on |
Well, everything is possible, but I don't think that the toolchain versions matter very much here. The issue seems to be on the Java side of things, not in the native interop, so NDK should not affect it. Java/Android alone have a very good story with compatibility (I'm looking at you, Apple), so I doubt that Java compiler is doing something weird here.
We use a standalone toolchain to build it, not Android Studio. It's available in |
Ok. Then I'll try other things before applying your toolchain to my app's build environment. [UPD] a link to |
I'm trying the guides below to check the "troubles from C# world"
But no success fo far. Things start to break when C# apk size optimizer (which they call "linker" for some reason) is set to more aggressive mode ( P.S. This comment is not a question but rather an update on "what I've discovered so far" |
thank you @dodikk, we're watching your progress! Linker's optimization is a good guess, do you think it's possible to disable it / change optimization level? |
@vixentael sure thing it is possible. But I cannot use
Also, xamarin allows specifying manually "which symbols should stay" (see the link below). But I'm viewing that as "weapon of last resort" since that approach would be rather time-consuming (just like writing a [UPD] this docs page of MSDN seems relevant and helpful
|
SolvedWhat had to be done:
/cc @vixentael @ilammy |
Do you accept pull requests to your documentation?@vixentael , could you please share the URL of the corresponding repo? As far as I've understood so far... Native android devs might run into such issue as well. So documenting this pitfall (in the Installing JavaThemis for Android development) guide might make sense.
|
Sure we do. The docs live here: https://github.com/cossacklabs/product-docs Though, I'm not sure if this is an issue strictly related to Themis. Android Studio sets up ProGuard in Android projects by default, but the issue seem to be generic enough to happen with any other library if that's ProGuard 'optimizing away' parts that it does not deem essential when in fact they are. I think, if this issue affects multiple projects then it's worth documenting to caution developers. Otherwise, I don't think that Themis docs should bloat into a list of trivia and howtos on configuring (effectively) third-party components of the build. I guess, if this issue pops up for someone else they can be directed here at first. @vixentael, what's your take? |
I'd mention this on Installation page, maybe like a separate paragraph "Configuring ProGuard rules" under "Installing stable version with Gradle". I totally agree with @ilammy that we shouldn't put all the tips&tricks into docs, but this is a tricky issue which might take some time to troubleshoot, so having it mentioned somewhere with link to this issue makes sense to me. @dodikk can you add these proguard rules to your sample project? As an illustration. |
@vixentael sure. Of course I'll do that. |
Amazing, really waiting forward! |
@vixentael , I have updated Will update the default branch of demo repository later, after more testing. |
Add info to docs here cossacklabs/product-docs#28 |
Describe the bug
Getting
Java.Lang.IncompatibleClassChangeError: no non-static method "Lcom/cossacklabs/themis/SecureCellSeal;.decrypt([B[B)[B"
inRelease
configuration in C# android project.When decrypting "obfuscated" string constant on app start.
Any ideas? Have you seen anything like this in some java or kotlin android project?
To Reproduce
On app start I try to decrypt an "obfuscated" string constant
Getting an error in
Release
configuration:Expected behavior
N/A - this issue is a question
Environment (please complete the following information):
Additional context
Sorry for asking in a wrong place if I'm violating any of your policies with this ticket.
I've spent a while debugging it and am a bit desperate at the moment.
I know you do not support that C# and Xamarin.Forms but filing this question just in case you've seen a similar issue in some
java
orkotlin
android project.Unable to share a sample project
since that does not reproduce on https://github.com/dodikk/themis-xamarin-prototype/tree/bugfix/v0.13.2/droid-strip-symbols
Only in a project under NDA, unfortunately.
wasm-themis
CLI tools. Also I can decrypt thedata collected from my app's exception (again, with
wasm-themis
CLI tools)debug
configurationapk
seems to haveSecureCell
andSecureCellSeal
class symbols (checked via "profile apk" UI in android studio)The text was updated successfully, but these errors were encountered: