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.
Related
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.
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.
I have an Android NDK project whose NDK part compiles ok from command line;
I used to have no problems with running the compiled stuff from under Eclipse as a pure Java project. But I converted it to a C/C++ project and now cannot even run it.
I see in the "Console" that the library is built,
BUT: Eclipse tells me that my project has errors and it will not run it.
(Why on Earth? The code is compiled!!!)
I have resolved some issues with missing symbols by adding include paths to the project properties.
But I'm still getting this weird
Function '__android_log_print' could not be resolved
error.
So, two questions:
How do I get rid of this error? (Can it be ignored?)
Plan B: how do I convert this mixed C/C++/Java project to a pure Java one?
= = =
PS "As you call the ship, so it will do". Could not they just find a better name for an IDE, something like "Lucid coding"? (Rhetoric question)
= = =
UPDATE: It looks like Eclipse reports errors only for the files that it sees (that is, shows you). I have opened another file with a LOGD macro, and the Eclipse reported an error for it too. I have closed all file windows, closed Eclipse and deleted a .something file. After that, I was able to run the application. I did not risk to open the source files with that logging macro. (That's very far from "Lucid coding", isn't it?)
The configuration of CDT indexer needs to enable "Index unused headers ..."
How to get there: Project->Properties->C/C++ General->Indexer.
Gets rid of the error for me.
How it can be ignored: open 'Problems' window, select errors in c/c++ files and press Del key. A confirmation msg box will be shown, but after that you can debug your app... until next rebuild =)
Alternatively, as you mentioned earlier, you can just close all opened c/c++ files.
In your Android.mk file, please add
LOCAL_LDLIBS := -llog -landroid
The __android_log_print isn't part of libc, it's in the log library, so you need to explicitly declare it to be linked in.
Note the eclipse will refuse to run the project if there's errors on either the C or java side. In this case, there's a linker error; the code didn't successfully finish compiling, so it won't run it.
alternatively you can retype these strings and restart an Eclipse; All these fixes sounds lame though...
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()
I am trying to build the bitmap-plasma sample that is included with the ndk, but getting an error. I run ndk-build from the samples/bitmap-plasma directory, and the error it displays is that it cannnot locate android/bitmap.h file.
How do i direct the ndk-build script to the file it needs?
Using android-ndk-r4 on Ubuntu Lucid 10.04
Well it's working now, so in case anyone was having my same problem:
There as an android-ndk-r4b bugfix release today, which it seems no longer has this problem.
Available to download here.
http://developer.android.com/sdk/ndk/index.html
With Ubuntu 10.04 and NDK r5b, I have just posted a bug report (with the fix included) for build_platforms.sh. See http://code.google.com/p/android/issues/detail?id=15180 for details. Essentially, the local declarations in the symlink routine must be amended. Otherwise, it only links the first file (alphabetically) from each directory, and truncates the remainder from the list.
Correcting this allowed the symbolic links to be fully populated, thereby filling in the missing header files and libraries and allowing the samples to build successfully.