Can't build C++ project with Android toolchain - android

I'm using Eclipse Luna on Windows 8 and trying to use an existing C++ project with Android.
I have download the NDK and set the location in Window->Preferences->NDK
I'm getting many compile errors in the jni directory which are probably caused because of Unresolved inclusions (like stdio.h, string, jni.h etc).
The current toolchain is Android GCC. The path and symbols include some stuff from the NDK folder after I ran the ndk-build.cmd from inside the project's folder, but there probably some includes missing.
I'm not sure what else I need to do in order to build the project.

It seems that the problem was and still is with Eclipse itself. The build actually passed but Eclipse still for some reason showed errors which are not really errors and everything is actually working.
This is another proof that Visual Studio is SO much better than Eclipse...

Related

How can I do command line debugging using Android NDK

I am trying to debug a C++ Android application using Android NDK r20.
The project used to use the old way of building using ndk-build and the android.mk file.
Now the project is migrated to using gradle and cmake. Because of this, the ndk-gdb script no longer works, since it uses the old build system which expects an android.mk file.
So how am I supposed to debug from the command line using the latest ndk along with a gradle/cmake build system? Is there a new script that is provided?
ndk-gdb doesn't know how to do it out of the box right now. You can set up some symlinks in a gradle project to make the directory layout match a standalone ndk-build project which will let ndk-gdb work. See https://android.googlesource.com/platform/ndk/+/refs/heads/master/samples/NdkGdbSample/ for an example.
ndk-gdb doesn't work at all with CMake though.
See https://github.com/android-ndk/ndk/issues/1024 (I assume that's actually you that filed it). I don't know when we'll be able to do it, but what's described there is essentially what we'll do. We'll keep the existing script, get it to work with gradle projects, and (eventually) switch it to lldb under the covers.
Using Android Studio is your best bet for native debugging on Android right now.

Unable to select JNI build variant after upgrading Android Studio to version 3.3

I have a Java Android project that includes JNI code written in C.
I often need to debug into the native code and before upgrading Android Studio to version 3.3 it was working.
Now in my project view I don't have any code in my cpp folder. I have confirmed that all of the C libraries are in the folder on my HDD. The CMAKE file is also missing from the project view but is also in the correct place on my HDD.
I have not changed any code from my source control since upgrading.
I am using
'com.android.tools.build:gradle:3.3.0'.
In the Build Variants section next to my JNI module I just have five dashes instead of the debug/production options.
I have uninstalled and reinstalled android studio too.
Is it possible after upgrading I need to add something to my configuration to correct including CMAKE?
I had the same issue, just figured it out. In AndroidStudio 3.3.1, they changed things around a bit I guess. Now you have to link your NDK build to the app you are building it as part of.
This is documented at: https://developer.android.com/studio/projects/gradle-external-native-builds
The section, "Use the Android Studio UI" is what you want.

Setting up JNI project for the first time -- is NDK required if I have NDT installed?

I'm starting a project where I will need to use JNI to allow Android to access embedded hardware peripherals.
I have Eclipse Juno installed and configured with the ADT and NDT. I have imported an existing application from github and I get an error when I try to build. This project is pointing at the NDK folder on the project owner's filesystem. I naively figured that this would be specified by the Eclipse environment, but apparently it isn't.
I thought that if the NDT was installed, that it automatically installed the NDK for me, but I haven't been able to find information about this. I can go ahead and download the latest NDK and then change the project to point to my newly-downloded NDK's location, but don't want to do this if it is redundant.
Also, can someone point me to the place in the Project Properties tree that allows me to select the NDK location, so I don't have to manually modify the .cproject file?
It was probably silly to ask this question without downloading and installing the NDK -- it's not like "installing" leaves artifacts and I could have just deleted the folder if it was not necessary. I went ahead and installed r8e and replaced the reference in the .cproject file, and the project compiled okay.

How to set up Android CTS in Eclipse?

How should I set up Android CTS in Eclipse?
I have tried to follow the guide at Android Open Source Project for setting up CTS development in Eclipse. However, I get build errors when trying to set it up in Eclipse Indigo with android-2.3.7_r1 on Ubuntu 10.04 x86_64.
Eclipse refuses to build the project due to missing libraries. When these libraries are removed from the build path it still won't build, due to several hundred or so missing imports (for example import android.annotation.cts.Profile;).
I had the same problem during the instantiation of AOSP in Eclipse. javalib.jar for google-common_intermediates was missing and the second javalib.jar was also missing. In this case I simply removed the second library from the build path and the first library was simply renamed to android-common_intermediates. Maybe in your case, there are also some renamings?

Significance of com.android.ide.eclipse.adt.LIBRARIES in build path?

I've update to the latest SDK(4.0.x), tools(r16) and plugin(16.0.1) for Eclipse. I notice that now nearly all my projects in Eclipse have the library mentioned in this question's title showing as a referenced library in the Libraries tab of the Java build path. This is relatively new, though I'm not sure in which upgrade of the SDK it appeared.
It's not causing any problems but I'd quite like to know what its purpose is?
Interestingly it does not appear in projects which I also build using Ant from the command line. In these projects I send the Ant built binaries to a folder outside the Eclipse workspace. These projects naturally have a build.xml, an ant.properties and a proguard.cfg in the project root. This I suspect has something to do with why the com.android... library isn't in the build path. These projects build perfectly OK when built under Eclipse.
None of my projects are library projects.
Update: If I delete it from the Java build path, it appears to have no ill effects, in so far as the app still builds (even under Eclipse) and runs OK.
If you have any "Android Libraries" set in the Android section of the project then these are for linking in those libraries (the jars that the plugin will build)

Categories

Resources