Android Ndk Build, Method Could Not Be Resolved

Android NDK build, Method could not be resolved

After some struggling with preferences, I finally found a solution. This is a bug in NDK plugin which was reported to AOSP but not yet fixed. A past of the answer is described in comment #50. Here is the sequence which worked our for me.

  1. Open Project Properties -> C/C++ Build -> Tool Chan Editor
  2. In the section Used Tools replace Android GCC Compiler with GCC C Compiler. If section is empty, just add GCC C Compiler entry in there.
    Sample Image
  3. Open Project Properties -> C/C++ General -> Paths and Symbols and add directories, where your h-files to be included are located. Use Move up button to add a folder with your local includes (/AudioPlayer/jni in my case) to the first place. Then add platform and toolchains includes. Built-in includes should stay at the very bottom.
    Sample Image
    In my case the full paths to the toolchain includes were like below. These are built-in paths of original Android GCC Compiler toolchain, which we have replaced at step 2.

    /Tools/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include
    /Tools/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.6/include-fixed
  4. Press OK button, clean and re-build the project. All errors must go away. If they stay, try to remove them from Problems view and re-build project once again.

Update: I have found another place, where you can add paths to include files. However it appears to be Eclipse version dependent. Project Settings -> C/C++ General -> Processor Include Paths, Macros etc. -> CDT User Settings Entries -> Add. After I added the paths listed above, there is no compilation issues anymore. Development is fun again.

Eclipse ADT ... could not be resolved with Android NDK and C files

This may is not be the right way to fix the problem, but you can find the file ${WORKSPACE_LOC}/.metadata/.plugins/com.android.ide.eclipse.ndk/${ProjName}.pathinfo. It is a text file, in simple format. To begin with, try to delete this file, and rebuild the project. If this does not help, you can add

i,d:/android/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/lib/gcc/arm-linux-androideabi/4.6/include
i,d:/android/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/lib/gcc/arm-linux-androideabi/4.6/include-fixed
i,D:/Android/android-ndk-r9/platforms/android-14/arch-arm/usr/include

manually (the example above is for Windows).

Update a better workaround is to set up ADT to work with indexer correctly, see Android NDK build, Method could not be resolved or Eclipse compiles successfully but still gives semantic errors.

How can I solve error of NDK - I can't build my app

For Android NDK, no paths may include spaces. This refers to:

  • project root
  • directory names inside the project
  • paths to 3rd party libraries and dependency projects
  • path to Android SDK
  • path to NDK itself

In your case, Android SDK was installed in C:\Users\Abir CSE\AppData\Local\Android. Move it to a directory outside your %HOME%.

NDK is not configured issue in android studio

This is the problem faced by Android studio users in Windows environment.
First for NDK not Configured problem

Go to local.properties file and give ndk path...
for ex :

#Wed Mar 18 14:10:33 IST 2015
sdk.dir=C\:\\Users\\admin\\AppData\\Local\\Android\\sdk1
ndk.dir=C\:\\Users\\admin\\AppData\\Local\\Android\\ndk

Then for the Next Problem or Error...

Goto JNI Folder and create an empty c file by any name...
Then your problem will be solved...

Some Quick links about this are
http://ph0b.com/android-studio-gradle-and-ndk-integration/
And
https://code.google.com/p/android/issues/detail?id=66937

NDK- Build error

Go to the ndk location(cd C:\android\ndk) using command prompt.
Then type the command

ndk-build -C your_project_location

Hope this will get you in the right direction. You can find more information on "ndk-build" using the command

ndk-build --help

Java native methods could not be resolved in eclipse, Android NDK

Here is a simple solution

Go to the properties of your Application , under C/C++ General -->Code Analysis

Uncheck the Run As You Type (Selected Checkers) option as following screenshot.

Sample Image



Related Topics



Leave a reply



Submit