I am writing an android Native project which generate an executable file (compiled with both ndk r10e and ndk r12b), and when i try to run the generated executable it generates an error that it is not able to open it:
dlopen failed: library "libtest.so" not found
Obviously "/my/system/path/libtest.so" exist and has the right permissions ( 666 for example ).
This appens only in one of my devices. I have tested it in more than 10 devices and it seems to run perfectly.
I am not able to find out why this error is coming.
Please help me.
Probably the easiest way to work out exactly what's going on is to use strace. This will show you where it's trying to look for your libtest.so and why it's not finding it. See this answer for how to use strace on android.
Related
I want to use JavaCv with my App on Android.
Therefore I followed the advice here: https://github.com/bytedeco/javacv on how to install Android 2.2 or newer. As a result the following libraries can be found under \libs\armeabi:
libjniopencv_core.so
libopencv_core.so
All classes of both libraries are also present in the classes.dex file of my .apk.
And still i get the following exception:
java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libopencv_core.so" needed by "libjniopencv_core.so"; caused by load_library(linker.cpp:745): library "libopencv_core.so" not found
I tried loading libopencv_core.so via
System.loadLibrary("libopencv_core")
and
System.loadLibrary("opencv_core")
with the same outcome..
Any hint on how to solve this issue would be appreciated.
Edit1:
I had a look to see which .so files could actually be found under /data/app-lib/ccc.android.myappname...
Despite libopencv_core.so and other files can be found under lib/armeabi/ in my .apk only some of them are available for my activity under /data/app-lib/ccc.android.myappname. The others are just ignored for some unknown reason.
Can somebody help, i have no idea what is going on.
Thank you.
Here the solution i found:
I discussed this matter on the JavaCv board on Github:
https://github.com/bytedeco/javacv/issues/28
The Issue might be history with the next release, but for the meantime do as follows:
Before using JavaCv for the first time run:
static {
System.loadLibrary("tbb");
System.loadLibrary("opencv_core");
System.loadLibrary("jniopencv_core");
}
On some devices (or occasion) the intended load order get mixed up...
I'm relatively new to Android and I have a problem using the ndk-build command.
I use the NDK r9d under Windows 7 64bits.
When I run my build system which creates my Android project (makefiles etc...) and then creates a process running ndk-build.cmd (I checked that it is call in the Android project) I get the error:
make.exe: *** create_child_process: DuplicateHandle(In) failed (e=6)
But when I run ndk-build.cmd "manually" in the windows command console in the same Android project created by my build system (or any Android project) everything is working.
I did find some related questions like here:
https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014825836
https://cygwin.com/ml/cygwin/2004-09/msg01506.html
But all I found says either that it's a problem of make version which is not (I think) since ndk-build works fine when I use it "manually" or it says that it is related to stdin handling and again I don't think that the issue here. Plus all the anwsers that I found was related to a similar error but not exactly the same:
process_easy: DuplicateHandle(In) failed (e=6)
Maybe someone knows the meaning of my error message. I don't think that's specific to Android ndk-build but maybe.
Thank you for reading (and sorry for any english mistakes, I am french and not fluent in english)
Finaly, I found a solution to my problem here:
http://www.zeusedit.com/zforum/viewtopic.php?t=174
I am not sure about what the problem was but according to this link, it was related to the make environment and the handles.
The solution : Instead of using the createProcess function (from Windows) directly to call ndk-build.cmd, I created a batch file containing:
start ndk-build.cmd
And I called this batch (.bat) via the createProcess function.
I let you see the link for more details.
First, I already read 3 or 4 tutorials, 20 related questions on stack overflow, I am desperate, nothing seems to work...
I run on mac os x, on eclipse juno, ndk-r8
I try to debug an application (.apk) that use a library (.jar), that use many native library (.so).
My 2 AndroidManifest.xml contains debuggable=true, i compile the .so with "ndk-build NDK_DEBUG=1"
but when i call "ndk-gdb", on the application directory, I get:
"ERROR: Could not find gdbserver binary under ./libs/none"
(which seems normal)
and in the library directory, i get:
"ERROR: Non-debuggable application installed on the target device."
(which is false)
when my program crash with a segv, if I use addr2line or ndk-stack, both says that my address is incorrect.
does anyone as an idea why gdb cannot attach to my process ? or have a workaround to do this ?
As I said earlier in comments:
ndk-gdb cannot attach to a process where the jni is inside an android library project.
As a workaround, you can put a mock main entry point in the library,
to transform it into a executable project, to execute it in debug mode.
I have checked a lot of threads already but none of them seems to solve my problem. I'm working on a project regarding my study and want to use the OpenCV library with my Android app. Here is a list of the programs and tools I use:
Eclipse IDE for Java Developers (3.7.0)
Android SDK r16
OpenCV 2.3.1
Android NDK r7b
I am following a tutorial, and everything works fine until the part where I need the NDK for using C++ OpenCV code. I can code and run Android apps and the "Tutorial 1" samples from the OpenCV 2.3.1 are working fine. However the "Tutorial 2" samples won't work. I tried following the steps in the C++ part of the tutorial.
When I try to run the NDK-build (tried both the command line and Eclipse part) I keep getting this error:
/usr/bin/sh: -c: line 1: syntax error: unexpected end of file
make: *** [obj/local/armeabi/objs/opencv/cvjni.o] Error 1
Does anyone has a solution for my problem? Thanks in advance
in bash script unexpected "syntax error: unexpected end of file" on if statement
Make sure your shell scripts use Unix-style line endings
I've been working with the vibration example from Adobe for Air 3.0's native extensions on Android.
I have the ANE compiled and the .apk packaged.
The problem I'm having is the actionscript library is getting a null ExtensionContext.
I tried creating the .apk with adt -package -target apk-debug so that I can see the actionscript traces in logcat and that's where I'm finding the null error.
extContext = ExtensionContext.createExtensionContext("com.adobe.Vibration", null);
extContext is null and crashes on the following .call() method.
All of the source is stock from the examples, I haven't changed anything.
Does anyone have any experience with getting one of Adobe's ANE examples working on a windows machine? Most of the examples are for Mac.
Good lord. What a waste of a week.
I was using a tutorial from gotoandlearn.com that was telling me to, in by build script, use a jar command to put my native extension in to a jar.
I simply used the .jar that's automatically built in the NativeAndroid/bin/ folder and all is well.
It turns out, that tutorial is out dated and not really useful for the build anymore.
One additional comment. You need to set target platform and checkbox Is Library from Properties -> Android to get compiled jar in bin folder.
P.S. .sh from gotoandlearn can be executed in Powershell in Windows with minor changes for running bat files: ( cmd "/c adt.bat" )
I'm having the exact same problem on a Native Extension I'm writing, and have open sourced. I started this project with tutorial code from Adobe DevNet. I've found examples of this specific issue I've tried to follow exactly, and have had no luck with it yet. I've identified it to be a sandbox allow-domain problem.
Here's my line of code:
_aneContext = ExtensionContext.createExtensionContext("com.adobe.sampleasextension", "");
Here is a link to the code in my GitHub project:
https://github.com/interactivenyc/ANESampleProject/blob/master/TEST_AndroidAIR/src/ANESampleTest.as
Here is my compiler error:
SecurityError: Error #3207: Application-sandbox content cannot access this feature.
at flash.system::Security$/allowDomain()
at com.adobe.sampleasextension::SampleASExtension()[/Users/stevewarren/Clients/Speakaboos/git_repositories/ANESampleProject/ANESampleSWC/src/com/adobe/sampleasextension/SampleASExtension.as:14]
at ANESampleTest/initializeANE()[/Users/stevewarren/Clients/Speakaboos/git_repositories/ANESampleProject/TEST_AndroidAIR/src/ANESampleTest.as:198]
at ANESampleTest/onAddedToStage()[/Users/stevewarren/Clients/Speakaboos/git_repositories/ANESampleProject/TEST_AndroidAIR/src/ANESampleTest.as:131]
at runtime::ContentPlayer/loadInitialContent()
at runtime::ContentPlayer/playRawContent()
at runtime::ContentPlayer/playContent()
at runtime::AppRunner/run()
at AppEntryCommon/run()
at global/runtime::AndroidMobileDeviceAppEntry()