不允许使用Gcloud直接配置“ debugCompile”

时间:2018-12-08 01:08:56

标签: android android-studio android-gradle build.gradle google-speech-api

我看到了很多有关此主题的问题,但没有任何帮助, 我是android的新手,我想使用Gcloud Speech API, 我正在:

  • 出了什么问题: 无法确定任务':app:extractIncludeDebugProto'的依赖关系。
      

    不允许直接解析配置'debugCompile'

我的gradle文件: Moudle:app:

apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'

ext {
    grpcVersion = '1.4.0'
}
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.example.atheel.tamkeengcloud"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.2'
    }
}
protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.3.0'
    }
    plugins {
        javalite {
            artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
        }
        grpc {
            artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
        }
    }
    generateProtoTasks {
        all().each { task ->
            task.plugins {
                javalite {}
                grpc {
                    // Options added to --grpc_out
                    option 'lite'
                }
            }
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
// gRPC
    implementation "io.grpc:grpc-okhttp:$grpcVersion"
    implementation "io.grpc:grpc-protobuf-lite:$grpcVersion"
    implementation "io.grpc:grpc-stub:$grpcVersion"
    implementation 'javax.annotation:javax.annotation-api:1.2'
    protobuf 'com.google.protobuf:protobuf-java:3.3.1'

    implementation group: 'com.google.api.grpc', name: 'grpc-google-cloud-speech-v1', version: '0.1.13'

    // OAuth2 for Google API
    implementation('com.google.auth:google-auth-library-oauth2-http:0.7.0') {
        exclude module: 'httpclient'
    }

    implementation 'com.android.support:multidex:1.0.0'

}

项目:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

请帮助。我卡住了

当我添加时:

project.configurations.debugCompile.setCanBeResolved(true)
project.configurations.debugCompile.each {
    println it
}

正如一种解决方案所说,我得到:

  • 出了什么问题: 无法确定任务':app:extractIncludeAndroidTestProto'的依赖关系。
      

    不允许直接解析配置“ androidTestCompile”

0 个答案:

没有答案