2017-07-19 14 views
0

私は、相互に依存するgradleモジュールをセットアップしようとしており、それらの間に適切なビルド構成を渡しています。私が得ているエラーは次のとおりです。ビルドタイプでローカルのgradleモジュールの依存関係をコンパイルするには?

Error: Configuration with name 'debug' not found. 

ビルドタイプが正しく宣言されています。何を追加する必要がありますか?

プロジェクトbuild.gradle:

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

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.1.2' 

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

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

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

アプリモジュールbuild.gradle:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.1" 

    defaultConfig { 
     applicationId "xyz.example.gradletest" 
     minSdkVersion 16 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
     debug { } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.2.1' 

    debugCompile project(path: ':lib1', configuration: 'debug') 
    releaseCompile project(path: ':lib1', configuration: 'release') 
} 

LIB1モジュールbuild.gradle:

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.1" 

    defaultConfig { 
     minSdkVersion 16 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
     debug { } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.2.1' 

    debugCompile project(path: ':lib2', configuration: 'debug') 
    releaseCompile project(path: ':lib2', configuration: 'release') 
} 

LIB2モジュールbuild.gradle:

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "24.0.1" 

    defaultConfig { 
     minSdkVersion 16 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
     debug { } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.2.1' 
} 

答えて

0

のGradleモジュールのbuild.gradleファイルの "アンドロイド" セクションに追加する必要がこれらの行:

defaultPublishConfig "debug" 
publishNonDefault true 
1

依存関係を解除するのが一般的であり、デバッグ。 削除すると機能する可能性があります。

debug {} //このモジュールをすべてのモジュールから削除します。

すべてのモジュールのグラデルファイルがあります。

関連する問題