Android studio error while creating project with NDK support - android

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

Related

Android Cmake Build command failed

I'm new with Cmake and ndk , when i build project i got this
Build command failed.
Error while executing process E:\AndroidSdkWindows\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Fehoo\Desktop\Rentie\android\butterfly-streamer -BC:\Users\Fehoo\Desktop\Rentie\android\butterfly-streamer\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-21 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Fehoo\Desktop\Rentie\android\butterfly-streamer\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\Fehoo\sdk\ndk-bundle -DCMAKE_TOOLCHAIN_FILE=C:\Users\Fehoo\sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=E:\AndroidSdkWindows\sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja -DANDROID_STL=c++_static}
(include) CMakeLists.txt
-- Check for working C compiler: C:/Users/Fehoo/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
note*
I instale Cmake and ndk with location on C drive
my os is Windows 10 x64
I found the problem it was with the directory of c++ files in CMakeLists file

Fail to create new Android NDK project

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.

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?

Categories

Resources