Closed alexbgameson closed 3 years ago
Hello @alexbgameson ,
why you have create manually the CMakeLists ? It should be done by the plugin.
The issue is closed, your problem is solved ?
@ben-j69 , I started using the plugin today and I am facing the same issue.
java.lang.UnsatisfiedLinkError: dlopen failed: library "libsecrets.so" not found
I followed the tutorial and checked if I could be doing something wrong but I didn't find why it is not creating the libsecrets.so.
I added the gradle code for C++ code into my build.gradle (app)
// Enable NDK build externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" } }
I have the folder app/src/main/cpp with 5 files: CMakeLists.txt, secrets.cpp, secrets.hpp, sha256.cpp, sha256.hpp.
Let me know if I have to open a new issue ticket.
Hello @andreluizreis,
sorry for your issue. Can you confirm me you enabled the ndk build ?
// Enable NDK build
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
@ben-j69 , Yes. I added it inside the android object after the defaultConfig in build.gradle(app). I downloaded the packages in the SDK Manager.
The Secrets.kt was created successfully. The problem is when I try to access the secret method, the app crashes.
@ben-j69, to make it work. I needed to add to my build.gradle(app):
android { defaultConfig { ndk { abiFilters 'armeabi-v7a', 'x86' } } }
I don't know why it is not necessary for your project or why other users didn't have that problem.
Digging more into the problem. The CPP library is not being created for 64bits platforms. It is why when I add that code above it works. However, I can't publish this code without supporting 64bits. I don't know if it has a command to force CMAKE to build the 64 bits versions.
@ben-j69, I found the solution for my issue. The NDK doesn't have the platform and it was giving problems to compile in 64-bits ABIs. So, when I updated the NDK to an older version it worked.
Hello!
Sorry about my last issue request.
I get this fatal error output in the logcat when running my java app:
2021-05-05 11:34:20.567 10645-10968/com.nanonodes.servers E/AndroidRuntime: FATAL EXCEPTION: Thread-13 Process: com.nanonodes.servers, PID: 10645 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.nanonodes.servers-t6bctHCf0XzknxVEfyXDDw==/base.apk"],nativeLibraryDirectories=[/data/app/com.nanonodes.servers-t6bctHCf0XzknxVEfyXDDw==/lib/x86, /data/app/com.nanonodes.servers-t6bctHCf0XzknxVEfyXDDw==/base.apk!/lib/x86, /system/lib, /system/product/lib]]] couldn't find "libsecrets.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1067) at java.lang.Runtime.loadLibrary0(Runtime.java:1007) at java.lang.System.loadLibrary(System.java:1667) at com.nanonodes.servers.Secrets.<clinit>(Secrets.kt:10) at com.nanonodes.servers.ui.login.PanelActivity$o.run(PanelActivity.java:1328) at java.lang.Thread.run(Thread.java:919)
App-level gradle:
Project-level gradle:
As you can see I have added externalNativeBuild. I have also run the ./gradlew hideSecret -Pkey=yourKeyToObfuscate command in the terminal.
secrets.cpp, secrets.hpp, sha256.cpp, sha256.hpp are generated in the src/main/cpp folder along with the CMakeLists.txt I created manually.