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

Android build: No implementation found for int com.zerotier.sockets.ZeroTierNative.zts_init() #194

Open
zhaoqp opened this issue Sep 3, 2022 · 6 comments

Comments

@zhaoqp
Copy link

zhaoqp commented Sep 3, 2022

there is no zts_init() in libzt.so
but in ZeroTierNative.java, there is a call to zts_init().

    if (zts_init() != ZeroTierNative.ZTS_ERR_OK) {
        throw new ExceptionInInitializerError("JNI init() failed (see GetJavaVM())");
    }

Please help~

@joseph-henry
Copy link
Contributor

Hmm, it's there. Welcome to the wonderful world of Java JNI: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html

Can you paste the full build log?

@zhaoqp
Copy link
Author

zhaoqp commented Sep 3, 2022

: )
Here's the build log and aar:
dist.zip

Hmm, it's there. Welcome to the wonderful world of Java JNI: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html

Can you paste the full build log?

@zhaoqp
Copy link
Author

zhaoqp commented Sep 4, 2022

My Java code:

val node = ZeroTierNode()
node.start()

and then Exception was thrown:

java.lang.UnsatisfiedLinkError: No implementation found for int com.zerotier.sockets.ZeroTierNative.zts_init()
(tried Java_com_zerotier_sockets_ZeroTierNative_zts_1init and Java_com_zerotier_sockets_ZeroTierNative_zts_1init__)

@zhaoqp
Copy link
Author

zhaoqp commented Sep 15, 2022

Hmm, it's there. Welcome to the wonderful world of Java JNI: https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html

Can you paste the full build log?

Hi Joe, have you got a chance to look into this? thanks

@tejas238
Copy link

tejas238 commented Nov 14, 2022

@zhaoqp Have you managed to solve this? I'm having the same error but I'm unable to look into libzt.so in the .aar to see if the method is present. I wonder if there is a linking problem between the native C++ and the java. Sadly, I'm not good enough at CMake to find if there's a misconfiguration. I'm using the latest libzt release 1.8.10.

@tejas238
Copy link

tejas238 commented Nov 23, 2022

@zhaoqp @joseph-henry created #201 to address this- ./build.sh android-aar with latest gradle and cmake versions is now building correctly. It looked like the .cxx interface update to the Java JNI build was missing for android which was included in CMakeLists.txt.

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

No branches or pull requests

3 participants