Your APP_BUILD_SCRIPT points to an unknown file using Android ndk-build
I get the following error while trying to compile an Android NDK project:
ndk-build
Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /home/lambergar/work/APIExample/jni/Android.mk
/home/lambergar/android/ndk/android-ndk-r5c/build/core/add-appl开发者_运维技巧ication.mk:116: *** Android NDK: Aborting... . Stop.
The weird thing is, that the 'unknown file' (Android.mk) exists under the path reported as invalid.
Same problem (in Windows 7) but the cause is different.
After searching in the Environment parameters, I've found the evil thing named "NDK_PROJECT_PATH" which has value is an invalid path.
Deleted it and things are working again ;)
In my case the problem was with white spaces in the project path. In such case, change the project path folders and import the project again.
Just saw this problem today. In my case actual problem was spaces inside path to project.
(yes, ndk-build
will not compile your project if you have spaces inside folder name)
I just had the same problem. I fixed it by creating a Application.mk in $NDK/apps/ndktestapp with following content:
APP_PROJECT_PATH := /cygdrive/c/workspace/MyApp
and then calling
make APP=ndktestapp
from the NDK-Root. Hope that helps.
I solved the problem by adding a new build to the project and voila, it works... Don't know what was the problem with the CLI build though.
You need to set the env variable NDK_PROJECT_PATH
to the root of the project you are building. The root of your NDK project will typically contain the ./jni
directory.
export NDK_PROJECT_PATH={root_of_project}
If your JNI code is in a library, then set NDK_PROJECT_PATH
to the library project.
Do not make any white space in the Project Directory. If errors come again then edit the build.gradle(Module:app) below buildTypes block and add those line like below:
buildTypes {
release {
......................
}
}
sourceSets { main { jni.srcDirs = ['src/main/jni/','src/main/jniLibs/'] } }
externalNativeBuild {
ndkBuild {
path 'build/intermediates/ndk/debug/Android.mk'
}
}
Just spent an hour or two trying to figure this one out. Many, many people have had this problem. But as I found out I actually did not have a file name Android.mk it was named Andriod.mk and that was enough to cause me a lot of trouble. Sorry about my original rant but that was the whole problem in the end. I suggest if you have this problem you should check everything until you find something wrong.
This fixed me right up. Thanks guys you put me on the right track anyway.
Please remove these directories
rm -rf .externalNativeBuild //if exits
rm -rf app/.externalNativeBuild
rm -rf app/.cxx/ //if exits
rm -rf app/build/
then rebuild the project.
as the same as @phavens, i think that only wrong with the word Android.mk and android.mk file, just spent for 5 minutes .. hehe
in my case the project folder name had a space in it removed the space re imported it to Android Studio and that solved the problem
Details of the problem:
Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /jni/Android.mk ...: *** Android NDK: Aborting... . Stop. Usually this is not the path of your project, so the reason for this error is that ndk could not find the correct Android.mk file path. solution:
Add NDK_PROJECT_PATH to "./" in the environment variable, the purpose is to tell the NDK that the jni currently to be compiled is located in the directory where the project is located.
I encountered similiar probblems as in this topic. My solution is: firstly check the file exist in the correct path. Secondly, if your path have any whitespace, remove it or relocate your project to a simple path. Then rebuild it.
I just installed Android-NDK and tried "ndk-build". I had exactly the same error. Here is how I beat it.
bash
export NDK_PROJECT_PATH={root_of_android_ndk}/samples/hello-jni
./ndk-build
This worked.
Inside Android.mk file, you give the path where the jni folder loacted... in your case ARTOOLKIT_DIR :=/home/lambergar/work/APIExample/
For me, deleted the .gradle
and app/.externalNativeBuild
directories and it worked.
I also had space in the path for one of the folders. I struggled for 2-3 hrs understanding the problem and wondering why it said it is not able to find a file in a path which I was able to see. On seeing answers here, I removed space in one of the foldername in the path and voila, it started working.
Gradle Experimental plugein in Android Studio add support for Native project build.
精彩评论