错误:任务执行失败:linux中的buildNative

时间:2017-01-24 15:31:35

标签: android android-ndk build.gradle bazel

最近我已将我的AS更新为2.2.3并且我收到此错误:

  

错误:任务':buildNative'执行失败。   启动流程问题' / usr / local / bin / bazel''

我是 UBUNTU 用户,这是我的 build.gradle

def bazel_location = '/usr/local/bin/bazel'
def cpuType = 'armeabi-v7a'
def nativeDir = 'libs/' + cpuType

project.buildDir = 'gradleBuild'
getProject().setBuildDir('gradleBuild')

allprojects {
    repositories {
        jcenter()
    }
}

buildscript {
    System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'

    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.3'
    }
}

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    lintOptions {
        abortOnError false
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src', '../../contrib/android/java']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }

        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

ext {
    supportLibraryVersion = '24.0.0'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    // Support libraries
    compile("com.android.support:support-v4:$supportLibraryVersion") {
        force = true;
    }
    compile("com.android.support:appcompat-v7:$supportLibraryVersion") {
        force = true;
    }
    compile("com.android.support:cardview-v7:$supportLibraryVersion") {
        force = true;
    }
    compile("com.android.support:recyclerview-v7:$supportLibraryVersion") {
        force = true;
    }
//    compile("com.android.support:support-annotations:$supportLibraryVersion") {
//        force = true;
//    }
    compile("com.android.support:design:$supportLibraryVersion")
    compile("com.android.support:palette-v7:$supportLibraryVersion")

    // RxAndroid
    compile 'io.reactivex:rxandroid:1.2.1'
    compile 'io.reactivex:rxjava:1.1.8'

    // Glide
    compile 'com.github.bumptech.glide:glide:3.7.0'
}

task buildNative(type:Exec) {
    workingDir '../../..'
    commandLine bazel_location, 'build', '-c', 'opt', \
      'tensorflow/examples/android:tensorflow_native_libs', \
       '--crosstool_top=//external:android/crosstool', \
       '--cpu=' + cpuType, \
       '--host_crosstool_top=@bazel_tools//tools/cpp:toolchain'
}

task copyNativeLibs(type: Copy) {
    from('../../../bazel-bin/tensorflow/examples/android') { include '**/*.so' }
    into nativeDir
    duplicatesStrategy = 'include'
}

copyNativeLibs.dependsOn buildNative
assemble.dependsOn copyNativeLibs
assembleDebug.dependsOn copyNativeLibs
`

0 个答案:

没有答案