I'm trying to rebuild my Native android project, however all of a sudden, ndk-build decides it doesn't want to, and seems to be sulking on me.
Here's my output:
nathan#nathan-K52F:~/COMBAT/engine/android-build$ android update project -p . -t 1 -s
Updated project.properties
Updated local.properties
Updated file ./proguard-project.txt
nathan#nathan-K52F:~/COMBAT/engine/android-build$ cd jni && ndk-build
nathan#nathan-K52F:~/COMBAT/engine/android-build/jni$ ndk-build
nathan#nathan-K52F:~/COMBAT/engine/android-build/jni$ cd ../
nathan#nathan-K52F:~/COMBAT/engine/android-build$ ndk-build
nathan#nathan-K52F:~/COMBAT/engine/android-build$ //should be erroring here - yet nothing?
It however at least tries to build another native project:
nathan#nathan-K52F:~/GamePlay/samples/browser/android/jni$ ndk-build
/home/nathan/android-ndk-r8e/build/core/add-application.mk:128: Android NDK: WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 9 in /home/nathan/GamePlay/samples/browser/android/AndroidManifest.xml
Android NDK: ERROR:/home/nathan/GamePlay/samples/browser/android/jni/Android.mk:gameplay: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that /home/nathan/GamePlay/samples/browser/android/jni/../../../../gameplay/android/obj/local/armeabi/libgameplay.a exists or that its path is correct
/home/nathan/android-ndk-r8e/build/core/prebuilt-library.mk:45: *** Android NDK: Aborting . Stop.
nathan#nathan-K52F:~/GamePlay/samples/browser/android/jni$
The error's are suppose to be there by the way.
I just haven't a clue why it isn't compiling the project I WANT it to compile - I don't think it likes me anymore :L
I'm running on the latest Ubuntu OS, with NDK r8 and JDK 1.7
I didn't add my the new files to my makefile to be compiled.
Related
Good evening.
I'm stuck trying to compile a HelloWorld using the cocos2d-x.
I used the following commands:
cocos compile -p android --android-studio
cocos compile -p android --android-studio
cocos compile -p android
And I always had the same answer
Android NDK: ERROR:C:\Users\santi_000\Desktop\Android\cocos2d\HelloWorld\proj.android\../cocos2d/external/freetype2/prebuilt/android/Android.mk:cocos_freetype2_static: LOCAL_SRC_FILES points to the missing file
Android NDK: Check que C:/Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android/../cocos2d/external/freetype2/prebuilt/android/arm64-v8a/libfreetype.a exists or que its path is correct
make: Entering directory `C: /Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android '
C: / Users / santi_000 / AppData / Local / Android / sdk / ndk-bundle / build //../ build / core / prebuilt-library.mk: 45: *** Android NDK: Aborting. Stop.
make: Leaving directory `C: /Users/santi_000/Desktop/Android/cocos2d/HelloWorld/proj.android '
Error running command, return code: 2.
I found some pages here in StackOverFlow however none of them helped me. I'm using Windows. I realized I do not even have the arm64-V8A folder, what do I do? Where I can copy it, or how can I generate it?
Thank you.
The following worked for me
cocos compile --android-studio --target android-22
--ap android-22 --ndk-mode debug --ndk-toolchain arm-linux-androideabi-4.9
--platform android --app-abi armeabi --src C:\cocos2d-x\tests\cpp-tests
You will need to replace the --ndk-toolchain to the proper one that comes with your NDK installation. Check in the toolchains folder inside NDK_ROOT.
The most important one that actually got it working was --app-abi armeabi as that is what was the toolchain used.
[Edit]
If you actually check cocos compile -h you will see that --app-abi mentions armeabi as the default. But that is not the case. It is picking up arm64 as the default.
First of all, the commands to compile the android project starts with cocos not coconuts.
cocos compile -p android --android-studio
or
cocos compile -p android
Now, for the above error, it seems, you haven't set NDK_HOME path in environment variable.
You can set it manually or goto your cocos2d-x library folder from terminal and run
./setup.py
It will do the rest.
I am totally new to programming.
I am using windows 7 and eclipse.
I have searched all the place and i have tried all of the recommended solution and nothing works for me. Please let me know how to change them.
So please help me to understand what you are trying to say.
The cocos version i am using is 3.3 (cocos2d-x-3.3)
NDK is version r9D
Thank you.
I am not sure why CDT Build console is giving me these errors.
"
**** Build of configuration Release for project KIKILA ****
python C:/Users/SM/workspace/KIKILA/build_native.py -b release all
Android NDK: WARNING: APP_PLATFORM android-15 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Android NDK: WARNING: Ignoring unknown import directory: jni/../../cocos2d
Android NDK: WARNING: Ignoring unknown import directory: jni/../../cocos2d/external
Android NDK: WARNING: Ignoring unknown import directory: jni/../../cocos2d/cocos
Android NDK: C:\apps\adt-bundle-windows-x86_64-20140702\cocos\cocos2d-x-3.3\external/flatbuffers/Android.mk: Cannot find module with tag 'external/jansson' in import path
jni/Android.mk:41: *** Android NDK: Aborting. . Stop.
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Traceback (most recent call last):
File "C:/Users/SM/workspace/KIKILA/build_native.py", line 159, in <module>
Android NDK: The following directories were searched:
build(opts.ndk_build_paSM,opts.android_platform,opts.build_mode)
File "C:/Users/SM/workspace/KIKILA/build_native.py", line 146, in build
do_build(cocos_root, ndk_root, app_android_root,ndk_build_param,sdk_root,android_platform,build_mode)
File "C:/Users/SM/workspace/KIKILA/build_native.py", line 82, in do_build
raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
Exception: Build dynamic library for project [ C:\Users\SM\workspace\KIKILA ] fails!
Android NDK:
make.exe: Entering directory `C:/Users/SM/workspace/KIKILA'
make.exe: Leaving directory `C:/Users/SM/workspace/KIKILA'
The Selected NDK toolchain version was 4.8 !
**** Build Finished ****
The problem was due to the build_native.py script.
The build_native.py hasn't been maintained for ages and it has been deprecated. So you can't rely on it to build your Android project. But Cocos guys haven't make it clear to developers.
Try use cocos run command instead.
You could run the following command to build and run your project.
cd KIKILA
cocos run -p android
Before running the cocos command, you might need to configure it:
cd COCOS2DX_ROOT(your cocos2d-x folder)
python setup.py
I have the following in my ".bashrc"
export ANDROID_SDK=/cygdrive/c/adt-bundle-windows-x86_64/sdk
export ANDROID_NDK=/cygdrive/c/android-ndk-r8d
export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$ANDROID_NDK
When I build the project it fails with the error below.
Android NDK: No local settings... build all in release mode !
Android NDK: ERROR:/home/XXX/jni/Android.mk:gcc: LOCAL_SRC_FILES points to a missing file
Android NDK: Check that //c:/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/libgcc.a exists or that its path is correct
/cygdrive/c/android-ndk-r8d/build/core/prebuilt-library.mk:43: *** Android NDK: Aborting . Stop.
Using the shell I can see that
//c:/ android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/libgcc.a"
cannot be found, yet
/cygdrive/c/ android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/libgcc.a
can be found. So the question is why is the NDK expanding the drive/path like this? (you can see it does not always do this see the last line of the error)
Is there a fix?
I have a similar question to that posted here:
Android NDK: why ndk-build doesn't generate .so file and a new libs folder in Eclipse?
...though I am running Windows 7, not Mac os. Essentially the ndk-build command is run, gives no error but doesn't create an .so file (also, since I'm on windows this should create a .dll and not an .so?). I tried running the command from the root, jni, src folders etc. but got the same result; cmd just returns to the prompter after a few seconds. I ran it again from the jni folder with NDK_LOG=1 parameter to see what was happening. Here is a portion of the transcript of the log results after running ndk-build in the jni folder (after it successfully identified the platform, etc.)...
Android NDK: Looking for jni/Android.mk in /workspace/NdkFooActivity/jni
Android NDK: Looking for jni/Android.mk in /workspace/NdkFooActivity
Android NDK: Found it !
Android NDK: Found project path: /workspace/NdkFooActivity
Android NDK: Ouput path: /workspace/NdkFooActivity/obj
Android NDK: Parsing /cygdrive/c/android-ndk-r8/build/core/default-application.mk
Android NDK: Found APP_PLATFORM=android-15 in /workspace/NdkFooActivity/project.properties
Android NDK: Application local targets unknown platform 'android-15'
Android NDK: Switching to android-14
Android NDK: Using build script /workspace/NdkFooActivity/jni/Android.mk
Android NDK: Application 'local' is not debuggable
Android NDK: Selecting release optimization mode (app is not debuggable)
Android NDK: Adding import directory: /cygdrive/c/android-ndk-r8/sources
Android NDK: Building application 'local' for ABI 'armeabi'
Android NDK: Using target toolchain 'arm-linux-androideabi-4.4.3' for 'armeabi' ABI
Android NDK: Looking for imported module with tag 'cxx-stl/system'
Android NDK: Probing /cygdrive/c/android-ndk-r8/sources/cxx-stl/system/Android.mk
Android NDK: Found in /cygdrive/c/android-ndk-r8/sources/cxx-stl/system
Android NDK: Cygwin dependency file conversion script:
...after which point it just runs the script mentioned in the last line, then terminates. Any ideas? Thanks!
Set up a builder. Refer to following article for how to do that:
http://maxters.net/2011/02/android-ndk-builder-for-eclipse-in-windows/
There is a "small" change beginning NDK r8 – Cygwin is not necessary anymore and I had a trouble when building native libraries with Cygwin and NDK r8 – there was some error message about cxx-stl...
Almost everything in the link above is OK, but leave Arguments in the Main tab blank and change Location to:
${env_var:ANDROID_NDK_ROOT}/ndk-build.cmd
I use system variable path ANDROID_NDK_ROOT, but you can provide a full path to the ndk-build.cmd.
Also, there is no need to set any variable in the Environment tab.
Set up your builder this way and you will be fine.
Just a note, Android is built on the top of the Linux OS, so even if you are on Windows you will get Linux libraries with .so extension.
Following link was instructive but missing a detail if you are configuring NDK support in Eclipse after CDT it already depricated (summer of 2017 already).
http://maxters.net/2011/02/android-ndk-builder-for-eclipse-in-windows/
Where you need to configure your external builder Location, instead of pointing to cygwin\bin\bash.exe and adding as Argument your ndk-build.cmd location this is what worked for me on Windows 7 and 10.
In "Edit Configuration" dialog for external builder do following:
- for Location -> specify where your "ndk-build.cmd" is. i.e "D:\Android\NDK\ndk-build.cmd"
- for Arguments -> just specify "all"
The NDK build system relies on wildcards to find the sources to compile. If you have a path wrong somewhere, it will find no sources and do nothing. Check Android.mk very carefully. More can't be said unless you post Android.mk and a description of the source tree.
I wand build project in windows, I get same Errors:
bash C:\linux\android-ndk1\ndk-build V=1
cygwin warning:
MS-DOS style path detected: C:\dev\android\workspace4_android\FFWall
Preferred POSIX equivalent is: /cygdrive/c/dev/android/workspace4_android/FFWall
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Android NDK: ERROR:jni/Android.mk:bambuser-libavcore: LOCAL_SRC_FILES points to a missing file
/cygdrive/c/linux/android-ndk1/build/core/prebuilt-library.mk:43: *** Android NDK: Aborting . Stop.
Android NDK: Check that jni/ffmpeg-android/build/ffmpeg/armeabi/lib/libavcore.so exists or that its path is correct
Another way building:
C:\art\android-ndk\ndk-build V=1
Cannot run program "C:\art\android-ndk\ndk-build": Launching failed
Error: Program "C:/art/android-ndk/ndk-build" is not found in PATH
PATH=[C:\Art\android-ndk;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Program Files\PC Connectivity Solution\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\MATLAB\R2011a\runtime\win32;C:\Program Files\MATLAB\R2011a\bin;C:\Program Files\MATLAB\R2007b\bin;C:\Program Files\MATLAB\R2007b\bin\win3;C:\dev\android\android-sdk-windows\tools;C:\cygwin\bin;C:/art/android-ndk/;C:\linux\android-ndk-r7b;C:\dev\android\eclipse]
Why this happened?
From: http://developer.android.com/sdk/ndk/overview.html#reqs
Required development tools
For all development platforms, GNU Make 3.81 or later is required. Earlier versions of GNU Make might work but have not been tested.
A recent version of awk (either GNU Awk or Nawk) is also required.
For Windows, Cygwin 1.7 or higher is required. The NDK will not work with Cygwin 1.5 installations.
Meaning, that you will have to install Cygwin. After that you can call the ndk-build like:
$ProjectPath> /cygdrive/c/myNdkPath/ndk-build
Please also check the "Getting Started" part of:
http://developer.android.com/sdk/ndk/index.html