Sign in to follow this  
Seabolt

Android Hello-JNI Build Help

Recommended Posts

Hey guys,

I've started development on Android, and currently it is handing me my butt. 

Let me give you a little timeline so far and make sure that I haven't screwed anything up:

I applied to the nVidia Tegra3 Developers group which they approved me for.
I "installed" android NDK using their installer. It supposedly installs everything needed to develop android. 

I do indeed have the Android SDK, NDK, Eclipse and Ant installed. A cursory look at my environment variables looks like the setup enough for me.

So then I bumble around Eclipse, (I've been a spoiled developer too long working in VS), and import the hello-jni project.

I run the build, it says I'm missing an environment variable for my project. Easy enough, setup an env var called NDK_PROJECT_PATH going to the root directory for the project.

I run the build again, and I get a bunch of warnings and the make command fails. 
Here are the warnings I get:

C:\NVPACK\android-ndk-r8d>ndk-build
C:/NVPACK/android-ndk-r8d/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-8 is larger than android:minSdkVersion 3 in C:\NVPACK\android-ndk-r8d\samples\hello-jni/AndroidManifest.xml
C:/NVPACK/android-ndk-r8d/build/core/setup-toolchain.mk:167: warning: overriding commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/setup-toolchain.mk:150: warning: ignoring old commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:439: warning: overriding commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/setup-toolchain.mk:167: warning: ignoring old commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:357: warning: overriding commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/obj/local/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:357: warning: ignoring old commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/obj/local/armeabi'
The process cannot access the file because it is being used by another process.
Gdbserver      : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
The system cannot find the path specified.
make: *** [C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi/gdbserver] Error 1
Press any key to continue . . .

 

Now I'm looking for some general help on what seems to be a very newby question:

How can I get Hello World to compile?

I see that it can't find a path specified. But I have no idea what path they're talking about. Also I see an error regarding accessing a file that's in use, but I don't have much of anything running.

I'm working on a Windows 7 machine, and while I'm an experienced programmer, this is my first time venturing outside of Visual Studios at all, so please don't assume much knowledge from me :)

Thanks!

Share this post


Link to post
Share on other sites

Android NDK: WARNING: APP_PLATFORM android-8 is larger than android:minSdkVersion 3

 

With compilers I usually start from the top of the errors. Looks like your SDK doesn't support that version of android.

 

The process cannot access the file because it is being used by another process.

 

Perhaps you tried once and the process never closed?

Share this post


Link to post
Share on other sites

Hm. How would I address those issues if you don't mind me asking? Should I re-install the SDK, or is this a project property? And if it's the latter how would I change that? And that is a possibility, though I don't see any obvious offenders in the task manager. Are there any exe's that I should be looking for?

Again sorry for all the (most likely stupid) questions, I'm just not entirely sure what I should be looking for and don't want to overlook anything.

Share this post


Link to post
Share on other sites

Well, I'm not sure what process is using your file, however a simple computer reboot will unload whatever is in use. If you still get the file in use error, then you will have to actually track down what has it open.

 

You got your files off of the nVidia Tegra3 developer site?

Share this post


Link to post
Share on other sites
I'm going to go over these from the start...

C:\NVPACK\android-ndk-r8d>ndk-build
C:/NVPACK/android-ndk-r8d/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-8 is larger than android:minSdkVersion 3 in C:\NVPACK\android-ndk-r8d\samples\hello-jni/AndroidManifest.xml

If you open AndroidManifest.xml, you'll see that it says minSdkVersion is 3. That's a problem, because the NDK requires a min SDK of version 8. Basically, your manifest file is saying "I support Android API level 3!" (which is Android 1.5), but that's a lie, and it's warning you about it, because your makefiles are (correctly) saying that it requires at least API level 8 (version 2.2). Just change minSdkVersion in AndroidManifest.xml to be 8.

C:/NVPACK/android-ndk-r8d/build/core/setup-toolchain.mk:167: warning: overriding commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/setup-toolchain.mk:150: warning: ignoring old commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:439: warning: overriding commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/setup-toolchain.mk:167: warning: ignoring old commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:357: warning: overriding commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/obj/local/armeabi'
C:/NVPACK/android-ndk-r8d/build/core/build-binary.mk:357: warning: ignoring old commands for target `C:\NVPACK\android-ndk-r8d\samples\hello-jni/obj/local/armeabi'

These all look like they're the same error, but I'm not 100% sure I understand it. Try fixing the first warning and dealing with these later.

The process cannot access the file because it is being used by another process.
Gdbserver : [arm-linux-androideabi-4.6] libs/armeabi/gdbserver
The system cannot find the path specified.
make: *** [C:\NVPACK\android-ndk-r8d\samples\hello-jni/libs/armeabi/gdbserver] Error 1
Press any key to continue . . .

This one looks goofy because it's saying it can't find the gdbserver (the server for the GDB debugger, used to remotely debug native Android code).

I've never had problems like this when I've developed native stuff for Android, but then again, I've always worked on OS X and I've never used any nVidia stuff (just straight Android SDK + NDK). Sorry I'm not much more help.

Share this post


Link to post
Share on other sites

So I had to re-install the entire Android SDK and NDK. But I got it working now finally.
Thanks for your help guys!

I'm sure I'll be bothering you plenty as my project goes on.

Share this post


Link to post
Share on other sites

Alright, one quick follow up, just to make sure I have this right: I got hello-jni to compile by running the ndk-build.cmd file that was in my NDK directory. Now I've made my own project that was essentially the same as Hello-Jni but with new file names and such, just to see if I could reliably build a program and work on it. I could not. 

When I tried to run the ndk-build again, it just re-compiled hello-jni. I changed my NDK_PROJECT_PATH in my computer's environment variables, but now I'm seeing there are tons of places where these environment variables can be set, where do I find them all?

Also I tried to provide a directory to the build script, and it would cd to my directory and then just compile hello-jni anyways.

I moved a copy of ndk-build to my projects jni directory. I tried running it from bash like so:

cd to my project root.
$ ./ndk-build

Then I get the output: 



./ndk-build: line 40: dirname: command not found
./ndk-build: line 132: uname: command not found
ERROR: Unknown host operating system:

Any idea what could cause this? Also if I cd to the jni directory and run the file from there, I get a "cannot find file specified" error and the build never happens.

How do you run your ndk-build file? Where is it located? What environment variables do you have setup, and where?

Sorry for the long question, but everytime I think I have something figured out, I get lost again.

Share this post


Link to post
Share on other sites

Okay, so after playing around with the Path variable, I got it to work again. It's really strange stuff though. For a bit I could only compile through clicking the ndk-build.cmd, if I ran it from the command line, it would compile Hello-jni. 

Anyways I have it compiling again, now I just have to solve my issues with linking. Thanks guys!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this