CMake的构建命令失败

时间:2019-05-15 08:49:46

标签: android android-studio android-studio-3.0

我更新了android studio,现在尝试运行该应用时出现以下错误。

Build command failed.
Error while executing process 
C:\Users\bhaskar\AppData\Local\Android\sdk\cmake\3.10.2.4988404\bin\cmake.exe with arguments {--build C:\Users\bhaskar\Desktop\New Projects\otv 
2\app\.externalNativeBuild\cmake\debug\armeabi-v7a --target baseUrl}
Unknown argument Projects\otv
Unknown argument 2\app\.externalNativeBuild\cmake\debug\armeabi-v7a
Usage: cmake --build <dir> [options] [-- [native-options]]

我尝试了链接,但对我没有用。 Android Studio CMake Error: Build Command failed

我的build.gradle文件是:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
    defaultConfig {
    applicationId "com.osolutions.otv"
    minSdkVersion 16
    targetSdkVersion 28
    versionCode 9
    versionName "1.1.1"
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true


    ndk {
        abiFilters "armeabi-v7a", "x86"
    }

    externalNativeBuild {
        cmake {
            version "3.10.2"
        }
    }

}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

lintOptions {
    abortOnError false
}

externalNativeBuild {
    cmake {
        path "CMakeLists.txt"
    }
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

implementation files('libs/YouTubeAndroidPlayerApi.jar')

// retrofit, gson
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta1'
}

我尝试清理并重建项目,使缓存无效并重新启动,并尝试了链接中的步骤(我没有共享任何链接)似乎对我没有用。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

我通过使用旧版本的cmake解决了它。我在路径中有两个版本文件夹

C:\ Users \ bhaskar \ AppData \ Local \ Android \ sdk \ cmake

3.6.41111459和3.10.2.4988404。我删除了3.10 ....文件夹并运行该项目,它运行正常。