Fail to create new Android NDK project - android

I want to learn how to write code in Android NDK.
I open the 'android studio guide' and on the 'create new ndk project' I follow the instruction.
I just create new project and add support for C++ code and that's it .. all the IDE code is in red and nothing can be compile.
Can't find any problem and I don't know what to do.
Tried to sync by clicking 'Try again' in first - and still fail.
The error message is:
CMake Error at
C:/Users/AppData/Local/Android/sdk/ndk-bundle/build/cmake/android.toolchain.cmake:40
(cmake_minimum_required): CMake 3.6.0 or higher is required. You
are running version 3.4.1 Call Stack (most recent call first):
C:/Users/AppData/Local/Android/sdk/cmake/share/cmake-3.4/Modules/CMakeDetermineSystem.cmake:98
(include) CMakeLists.txt CMake Error: CMAKE_C_COMPILER not set,
after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after
EnableLanguage
-- Configuring incomplete, errors occurred! Build command failed. Error while executing process
C:\Users\AppData\Local\Android\sdk\cmake\bin\cmake.exe with arguments
{-HC:\WORKSPACE\Android\Practice\NDK\Practice_001\app
-BC:\WORKSPACE\Android\Practice\NDK\Practice_001\app.externalNativeBuild\cmake\debug\armeabi
-GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=C:\Users\Rn\AppData\Local\Android\sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\WORKSPACE\Android\Practice\NDK\Practice_001\app\build\intermediates\cmake\debug\obj\armeabi
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:\Users\AppData\Local\Android\sdk\cmake\bin\ninja.exe
-DCMAKE_TOOLCHAIN_FILE=C:\Users\AppData\Local\Android\sdk\ndk-bundle\build\cmake\android.toolchain.cmake
-DANDROID_PLATFORM=android-24 -DCMAKE_CXX_FLAGS=-frtti -fexceptions} CMake Error at
C:/Users/AppData/Local/Android/sdk/ndk-bundle/build/cmake/android.toolchain.cmake:40
(cmake_minimum_required): CMake 3.6.0 or higher is required. You
are running version 3.4.1 Call Stack (most recent call first):
C:/Users/AppData/Local/Android/sdk/cmake/share/cmake-3.4/Modules/CMakeDetermineSystem.cmake:98
(include) CMakeLists.txt CMake Error: CMAKE_C_COMPILER not set,
after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after
EnableLanguage
-- Configuring incomplete, errors occurred!
Thanks for any help.

Click on the "Try again" in yellow banner. If you got the error still probably problem is with you do not have necessary library packages in your build.gradle file. Check if you have added necessary Support Library Packages in your build.gradle file. If doesn't then add it and "rebuild" your project.

Your error message is:
CMake 3.6.0 or higher is required. You are running version 3.4.1
I do not know whether you have your own CMake installation or you are attempting to use one that comes from Android Studio. My guess is that you have your own CMake installation. If so, upgrade it to 3.6.0 or higher.

Related

Android studio error while creating project with NDK support

I tried to create simple android application with NDK support. I followed https://developer.android.com/studio/projects/add-native-code.html#new-project while creating project. After creating project it gives me following error:
External Native Build Issues
Build command failed.
Error while executing 'C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\cmake.exe' with arguments {-HD:\AndroidNDKExample\app -BD:\AndroidNDKExample\app\.externalNativeBuild\cmake\release\armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\AndroidNDKExample\app\build\intermediates\cmake\release\obj\armeabi -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=19 -DCMAKE_CXX_FLAGS=-frtti -fexceptions}
-- Configuring incomplete, errors occurred!
CMake Error at C:/Users/Nilesh.Kashid/AppData/Local/Android/sdk/cmake/3.6.3155560/android.toolchain.cmake:351 (message):
Failed to parse Android NDK revision:
C:/Users/Nilesh.Kashid/AppData/Local/Android/Sdk/ndk-bundle/source.properties.
Call Stack (most recent call first):
C:/Users/Nilesh.Kashid/AppData/Local/Android/sdk/cmake/3.6.3155560/share/cmake-3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Error:executing external native build for cmake D:\AndroidNDKExample\app\CMakeLists.txt
Build command failed.
Error while executing 'C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\cmake.exe' with arguments {-HD:\AndroidNDKExample\app -BD:\AndroidNDKExample\app\.externalNativeBuild\cmake\debug\armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=D:\AndroidNDKExample\app\build\intermediates\cmake\debug\obj\armeabi -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\Nilesh.Kashid\AppData\Local\Android\Sdk\cmake\3.6.3155560\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=19 -DCMAKE_CXX_FLAGS=-frtti -fexceptions}
-- Configuring incomplete, errors occurred!
CMake Error at C:/Users/Nilesh.Kashid/AppData/Local/Android/sdk/cmake/3.6.3155560/android.toolchain.cmake:351 (message):
Failed to parse Android NDK revision:
C:/Users/Nilesh.Kashid/AppData/Local/Android/Sdk/ndk-bundle/source.properties.
Call Stack (most recent call first):
C:/Users/Nilesh.Kashid/AppData/Local/Android/sdk/cmake/3.6.3155560/share/cmake-3.6/Modules/CMakeDetermineSystem.cmake:98 (include)
CMakeLists.txt
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Error:executing external native build for cmake D:\AndroidNDKExample\app\CMakeLists.txt
I have downloaded CMake and LLDB android I am using Android Studio 2.2.3 version.
I had the same problem. This problem occurs in older versions of ndk.
Failed to parse Android NDK revision:
The problem was resolved after updating ndk.
The current ndk version is 13.1.3345770.
Reference :
https://developer.android.com/ndk/guides/index.html

Android Studio Gradle Fail

I tried to build my android project, I got this error message.
Error while executing 'C:\Users\Chen\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\cmake.exe' with arguments {-HC:\Users\Chen\Desktop\Project\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS_Android\app -BC:\Users\Chen\Desktop\Project\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS_Android\app.externalNativeBuild\cmake\release\armeabi -GAndroid Gradle - Ninja -DANDROID_ABI=armeabi -DANDROID_NDK=C:\Users\Chen\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Chen\Desktop\Project\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160\IPS_Android\app\build\intermediates\cmake\release\obj\armeabi -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=C:\Users\Chen\AppData\Local\Android\Sdk\cmake\3.6.3155560\bin\ninja.exe -DCMAKE_TOOLCHAIN_FILE=C:\Users\Chen\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=15 -DCMAKE_CXX_FLAGS=}
-- Check for working C compiler: C:/Users/Chen/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
-- Check for working C compiler: C:/Users/Chen/AppData/Local/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe -- broken
-- Configuring incomplete, errors occurred!
CMake Error: Could not open file for write in copy operation C:/Users/Chen/Desktop/Project/IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160/IPS-Competition-master-326592647c34e3535eb78372bea8ec1c58ca6160/IPS_Android/app/.externalNativeBuild/cmake/release/armeabi/CMakeFiles/3.6.0-rc2/CMakeCCompiler.cmake.tmp
CMake Error: : System Error: No such file or directory
I've installed CMAKE, LLDB, NDK. Can I get some help?
Thanks.
I think you need to install compiler driver of c++.

Compile vtk and ves libraries for Android on Linux unbuntu64

I have followed the instructions in this link: http://www.vtk.org/Wiki/VES/Developers_Guide
I have downloaded VES, Andoid ndk-r8b, Android Studio (which has Android sdk), adb, ant.
And following the instructions:
export ANDROID_NDK=/home/ahrgm/Downloads/android-ndk-r8b
cmake -P configure.cmake
cd build
make -j4
the following error appears:
loading initial cache file
/home/ahrgm/VES/CMake/toolchains/TryRunResults.cmake CMake Error at
/home/ahrgm/VES/CMake/toolchains/android.toolchain.cmake:745
(message): Could not find any working toolchain in the NDK.
Probably your Android NDK is broken. Call Stack (most recent call
first): /usr/share/cmake-2.8/Modules/CMakeDetermineSystem.cmake:93
(include) CMakeLists.txt:3 (project)
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly. Missing variable is:
CMAKE_C_COMPILER_ENV_VAR CMake Error: Error required internal CMake
variable not set, cmake may be not be built correctly. Missing
variable is: CMAKE_C_COMPILER CMake Error: Could not find cmake module
file:
/home/ahrgm/VES/Apps/Android/CMakeBuild/build/CMakeExternals/Build/vtk-android/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may
be not be built correctly. Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR CMake Error: Error required internal CMake
variable not set, cmake may be not be built correctly. Missing
variable is: CMAKE_CXX_COMPILER CMake Error: Could not find cmake
module file:
/home/ahrgm/VES/Apps/Android/CMakeBuild/build/CMakeExternals/Build/vtk-android/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake
Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred! make[2]: * [CMakeExternals/Stamp/vtk-android/vtk-android-configure] Error 1
make[1]: * [CMakeFiles/vtk-android.dir/all] Error 2 make: *** [all]
Error 2
How can I solve this problem?

Unable to build opencv for android using cmake on yosemite

I managed to build OpenCV 2.4.9 for java following the online instructions.
However I am unable to build for Android
I am using OSX Yosemite, CMake 3.0.2, OpenCV 2.4.9.
The output I get is the following:
platforms [2.4.9] % sh ./scripts/cmake_android_arm.sh CMake Error at platforms/android/android.toolchain.cmake:827 (list): list index: 17 out of range (-17, 16) Call Stack (most recent call first): platforms/build_android_arm/CMakeFiles/3.0.2/CMakeSystem.cmake:6 (include) CMakeLists.txt:56 (project)
-- Detected version of GNU GCC: 49 (409) -- Performing Test HAVE_CXX_WERROR_ADDRESS CMake Error at /Users/mam/Source/opencv/platforms/android/android.toolchain.cmake:711 (list): list sub-command REMOVE_DUPLICATES requires list to be present. Call Stack (most recent call first): /Users/mam/Source/opencv/platforms/build_android_arm/CMakeFiles/3.0.2/CMakeSystem.cmake:6 (include) CMakeLists.txt:2 (project)
CMake Error at /Users/mam/Source/opencv/platforms/android/android.toolchain.cmake:712 (list): list sub-command SORT requires list to be present. Call Stack (most recent call first): /Users/mam/Source/opencv/platforms/build_android_arm/CMakeFiles/3.0.2/CMakeSystem.cmake:6 (include) CMakeLists.txt:2 (project)
CMake Error at /Users/mam/Source/opencv/platforms/android/android.toolchain.cmake:718 (message): No one of known Android ABIs is supported by this cmake toolchain. Call Stack (most recent call first): /Users/mam/Source/opencv/platforms/build_android_arm/CMakeFiles/3.0.2/CMakeSystem.cmake:6 (include) CMakeLists.txt:2 (project)
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage CMake Error: Internal CMake error, TryCompile configure of cmake failed -- Configuring incomplete, errors occurred! See also "/Users/mam/Source/opencv/platforms/build_android_arm/CMakeFiles/CMakeOutput.log".
I tried setting both:
export ANDROID_NDK=~/android-ndk-r8e
and
export ANDROID_STANDALONE_TOOLCHAIN=~/android-toolchain
but both give same error. Any clues to what is causing this? Bad version of CMake?

cmake fails with android ndk

I am trying to build something using the Android NdK standalone toolchain. However, I am running into these errors.
CMake Warning at cmake/android.toolchain.cmake:387 (message):
Using value of obsolete variable ANDROID_NDK_TOOLCHAIN_ROOT as initial
value for ANDROID_STANDALONE_TOOLCHAIN. Please note, that
ANDROID_NDK_TOOLCHAIN_ROOT can be completely removed in future versions of
the toolchain.
Call Stack (most recent call first):
cmake/android.toolchain.cmake:476 (__INIT_VARIABLE)
/usr/local/Cellar/cmake/2.8.10.2/share/cmake/Modules/CMakeDetermineSystem.cmake:86 (include)
CMakeLists.txt:16 (PROJECT)
CMake Error at cmake/android.toolchain.cmake:412 (FILE):
file STRINGS file
"/Users/vgokhale/Desktop/android-ndk-r8e/sysroot/usr/include/android/api-level.h"
cannot be read.
Call Stack (most recent call first):
cmake/android.toolchain.cmake:548 (__DETECT_NATIVE_API_LEVEL)
/usr/local/Cellar/cmake/2.8.10.2/share/cmake/Modules/CMakeDetermineSystem.cmake:86 (include)
CMakeLists.txt:16 (PROJECT)
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER
CMake Error: Could not find cmake module file:/Users/vgokhale/Desktop/torch-android/src/build/CMakeFiles/2.8.10.2/CMakeCCompiler.cmake
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER_ENV_VAR
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_CXX_COMPILER
CMake Error: Could not find cmake module file:/Users/vgokhale/Desktop/torch-android/src/build/CMakeFiles/2.8.10.2/CMakeCXXCompiler.cmake
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
make: *** No rule to make target `install'. Stop.
There are two sets of errors. I have no idea where to begin with the first set. The android.toolchain.cmake file looks into sysroot by default but android is not installed there neither does Google require me to install it there.
Regarding the CMAKE variables, I found that most solutions involve installing Developer Tools, which I already have. I tried manually setting the CXX and CC variables but that did not help.
Any ideas as to where to start?
Thank you.
Ok, I'll do a bit of guesswork here, but I think you're using http://code.google.com/p/android-cmake/ and you're calling it with ANDROID_STANDALONE_TOOLCHAIN while providing it the path to your NDK. If I'm right, that's the problem.
You should either call it with ANDROID_NDK and provide the path to your NDK.
The android-cmake documentation suggests that this is the way to go.
or
Keep calling it with ANDROID_STANDALONE_TOOLCHAIN, but providing it the path to an installed toochain (something created with make-standalone-toolchain.sh)
If you want to go this way, you can find information about creating standalone toolchains in docs/STANDALONE-TOOLCHAIN.html in your installed NDK.

Categories

Resources