0

我发布了一个关于我遇到的问题的问题,它是答案,但出现的另一个问题比以前少,但它是一个我真的不明白的问题,因为我是使用 android studio 做应用程序 android 的新手。这些是给我安卓工作室的控制台错误:

第一的:

null 
Build command failed. 
Error while executing process C:\Users\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app -BC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS=-std=c++14 -fexceptions -frtti -DCMAKE_TOOLCHAIN_FILE=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja -DBUILD_TESTING=OFF -DANDROID_TOOLCHAIN=gcc-4.9} 
C:/Users/Raul del Rio/AndroidStudioProjects/MyApplication2 
../../AppData/Local/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake 
 (include)   CMakeLists.txt 
<a href="openFile:C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake">Open File</a> 
 (include)   CMakeLists.txt 
<a href="openFile:C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake">Open File</a> 
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\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app -BC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\.externalNativeBuild\cmake\release\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS=-std=c++14 -fexceptions -frtti -DCMAKE_TOOLCHAIN_FILE=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja -DBUILD_TESTING=OFF -DANDROID_TOOLCHAIN=gcc-4.9} 
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\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app -BC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS=-std=c++14 -fexceptions -frtti -DCMAKE_TOOLCHAIN_FILE=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja -DBUILD_TESTING=OFF -DANDROID_TOOLCHAIN=gcc-4.9}


 (include)   CMakeLists.txt 
Open File


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\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app -BC:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\.externalNativeBuild\cmake\release\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-15 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Raul del Rio\AndroidStudioProjects\MyApplication2\app\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle -DCMAKE_CXX_FLAGS=-std=c++14 -fexceptions -frtti -DCMAKE_TOOLCHAIN_FILE=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=C:\Users\Raul del Rio\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja -DBUILD_TESTING=OFF -DANDROID_TOOLCHAIN=gcc-4.9}


 (include)   CMakeLists.txt 
Open File


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage


CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage


-- Configuring incomplete, errors occurred!

这是我为解决过去的问题所做的更改:

android {
    compileSdkVersion 28
    defaultConfig {
    applicationId "com.example.rauldelrio.myapplication"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    externalNativeBuild {
        cmake {
            arguments '-DBUILD_TESTING=OFF', '-DANDROID_TOOLCHAIN=gcc-4.9'
            cppFlags "-std=c++14 -fexceptions -frtti"
        }
    }
}
4

1 回答 1

0

我也刚遇到这个问题。我认为我的 C 编译器/NDK 环境由于某种原因被损坏了。但是重新安装这些工具解决了这个问题。

重装C/NDK环境步骤:

  • Android 菜单:工具 > SDK 管理器
  • 外观与行为 > 系统设置 > Android SDK
  • SDK 工具选项卡
  • 取消选中 CMake、LLDB、NDK 并单击 OK(卸载它们)
  • 检查 CMake、LLDB、NDK 并单击确定(再次安装它们 - 需要一些时间)

强制刷新工具后,一切都再次正确编译。

于 2018-08-02T20:26:52.560 回答