Android Studio 3.0 Compile Issue (Cannot choose between Configurations) -


issue latest 3.0 build (beta 2) project has 1 sub module 3rd party have access build.gradle.

my project has 3 flavours, snap, uat, production. each has 2 build types, debug , release. when try build this.

error:cannot choose between following configurations of project :lp_messaging_sdk:   - debugapielements   - debugruntimeelements   - releaseapielements   - releaseruntimeelements of them match consumer attributes:   - configuration 'debugapielements':       - found com.android.build.api.attributes.buildtypeattr 'debug' wasn't required.       - found com.android.build.gradle.internal.dependency.androidtypeattr 'aar' wasn't required.       - found com.android.build.gradle.internal.dependency.variantattr 'debug' wasn't required.       - found org.gradle.api.attributes.usage 'java-api' wasn't required.   - configuration 'debugruntimeelements':       - found com.android.build.api.attributes.buildtypeattr 'debug' wasn't required.       - found com.android.build.gradle.internal.dependency.androidtypeattr 'aar' wasn't required.       - found com.android.build.gradle.internal.dependency.variantattr 'debug' wasn't required.       - found org.gradle.api.attributes.usage 'java-runtime' wasn't required.   - configuration 'releaseapielements':       - found com.android.build.api.attributes.buildtypeattr 'release' wasn't required.       - found com.android.build.gradle.internal.dependency.androidtypeattr 'aar' wasn't required.       - found com.android.build.gradle.internal.dependency.variantattr 'release' wasn't required.       - found org.gradle.api.attributes.usage 'java-api' wasn't required.   - configuration 'releaseruntimeelements':       - found com.android.build.api.attributes.buildtypeattr 'release' wasn't required.       - found com.android.build.gradle.internal.dependency.androidtypeattr 'aar' wasn't required.       - found com.android.build.gradle.internal.dependency.variantattr 'release' wasn't required.       - found org.gradle.api.attributes.usage 'java-runtime' wasn't required. 

i read there issues sub modules , build types read fixed. had add same build types or sub modules build.gradle , add

buildtypematching  'debug', 'release' 

when however, error,

error:could not select value candidates [debug, release] using alternatedisambiguationrule.buildtyperule.  apply plugin: 'com.android.application'  android {      repositories {         flatdir {             dirs project(':lp_messaging_sdk').file('aars')         }     }      // android parameters     compilesdkversion = 26     buildtoolsversion = '26.0.1'      compileoptions {         sourcecompatibility javaversion.version_1_8         targetcompatibility javaversion.version_1_8     }      dexoptions {         predexlibraries true     }      defaultconfig {         minsdkversion 19         versionname buildname         versioncode buildversion         multidexenabled true         resconfigs "en", "fr", "fr-rca"     }      signingconfigs {         release {          }     }      flavordimensions "default"      productflavors {         snap {             ext.betadistributiongroupaliases = "internal"             ext.betadistributionreleasenotesfilepath = 'changelog.txt'             ext.betadistributionnotifications = true             dimension "default"         }          uat {             ext.betadistributiongroupaliases = "internal"             ext.betadistributionnotifications = true         }          production {         }     }      buildtypes {         debug {             versionnamesuffix createversionnamesuffix()             applicationidsuffix '.debug'             minifyenabled true             testcoverageenabled false             buildconfigfield "string", "play_store_version_name", '"' + play_store_version_name + '"'             // workaround : https://code.google.com/p/android/issues/detail?id=212882             proguardfiles filetree(dir: 'proguard', include: ['*.pro']).aslist().toarray()             ext.enablecrashlytics = false         }          release {             versionnamesuffix createversionnamesuffix()             minifyenabled true             testcoverageenabled = false             signingconfig signingconfigs.release             buildconfigfield "string", "play_store_version_name", '"' + play_store_version_name + '"'             // workaround : https://code.google.com/p/android/issues/detail?id=212882             proguardfiles filetree(dir: 'proguard', include: ['*.pro']).aslist().toarray()         }      }      //used ignore duplicated entries added meta-inf     packagingoptions {         exclude 'license.txt'         exclude 'meta-inf/license'         exclude 'meta-inf/license.txt'         exclude 'meta-inf/license'         exclude 'meta-inf/license.txt'         exclude 'meta-inf/notice'         exclude 'meta-inf/notice.txt'         exclude 'meta-inf/notice'         exclude 'meta-inf/notice.txt'         exclude 'meta-inf/services/javax.annotation.processing.processor'     }      dexoptions {         javamaxheapsize "2048m"         dexinprocess true     }      lintoptions {         abortonerror true         xmlreport true         htmlreport true         disable 'missingtranslation', 'invalidpackage'         disable 'gradlecompatible', 'gradlecompatible'         disable 'newapi', 'newapi'         disable 'gradledependency'         disable 'unusedresources'         disable 'icondensities'         disable 'typographydashes'         disable 'contentdescription'         htmloutput file("$project.builddir/reports/lint/lint-result.html")         xmloutput file("$project.builddir/reports/lint/lint-result.xml")     }      testoptions {         unittests.returndefaultvalues = true     } }  greendao {     schemaversion 13     targetgendir 'src/main/java/' }  ext.betadistributionreleasenotes = system.getenv("changelog")  def createversionnamesuffix() {     def buildnumber = system.env.build_number     def buildtimestamp = new date().format('hh:mm dd/mm/yy')     return buildnumber ? " ($buildnumber)" : " ($buildtimestamp)" }  def getbuildversionfromname(string buildname) {     list data = buildname.tokenize(".")     string resultstring = "19";      (string s : data) {         resultstring += s;     }      if (system.env.build_number) {         resultstring += system.env.build_number     }      return integer.parseint(resultstring); }  //verify app before creating pull request task verifypr verifypr.dependson('clean') verifypr.dependson('lint') verifypr.dependson('checkstyle') verifypr.dependson('pmd') verifypr.dependson('testsnapdebugunittest')  dependencies {     // android dependencies     compile 'com.android.support:appcompat-v7:26.0.1'     compile 'com.android.support:design:26.0.1'     compile 'com.android.support:recyclerview-v7:26.0.1'     compile 'com.android.support:multidex:1.0.2'      // dagger dependencies     apt 'com.google.dagger:dagger-compiler:2.11'     compile 'org.glassfish:javax.annotation:10.0-b28'     compile 'com.google.dagger:dagger:2.11'      // rx dependencies     compile 'io.reactivex:rxandroid:1.2.1'     compile 'io.reactivex:rxjava:1.3.0'     compile 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.4.0'     compile 'com.jakewharton.rxbinding:rxbinding-support-v4:0.4.0'     compile 'com.squareup.whorlwind:whorlwind:1.0.1'     compile 'com.tbruyelle.rxpermissions:rxpermissions:0.9.4@aar'     compile 'com.jenzz:rxappstate:2.0.0'      // tools     compile 'com.crashlytics.sdk.android:crashlytics:2.6.5'      // butterknife     compile 'com.jakewharton:butterknife:8.4.0'      // google maps     compile 'com.google.android.gms:play-services-maps:11.0.4'     compile "com.google.android.gms:play-services-analytics:11.0.4"     compile 'com.google.android.gms:play-services-location:11.0.4'     compile 'com.google.android.gms:play-services-places:11.0.4'     compile 'com.google.android.gms:play-services-gcm:11.0.4'      // geofence     compile('pl.charmas.android:android-reactive-location:0.10@aar') {         transitive = true     }      // retrofit     compile 'com.squareup.retrofit2:retrofit:2.3.0'     compile 'com.squareup.retrofit2:adapter-rxjava:2.3.0'      // okhttp     compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'      // libphonenumber     compile 'com.googlecode.libphonenumber:libphonenumber:7.3.2'      // ui     compile 'com.tubb.smrv:swipemenu-recyclerview:5.0.2'      // eventbus     compile 'org.greenrobot:eventbus:3.0.0'      // database     compile 'org.greenrobot:greendao:3.2.0'      // chuck http inspector     debugcompile 'com.readystatesoftware.chuck:library:1.0.4'     releasecompile 'com.readystatesoftware.chuck:library-no-op:1.0.4'      // viewpager indicator     compile 'com.github.jakewharton:viewpagerindicator:2.4.1'      // amplitude     compile 'com.amplitude:android-sdk:2.13.2'      // tests     testcompile 'junit:junit:4.12'     testcompile "org.mockito:mockito-core:1.10.19"     testcompile "org.powermock:powermock-module-junit4:1.6.5"     testcompile "org.powermock:powermock-module-junit4-rule:1.6.4"     testcompile "org.powermock:powermock-api-mockito:1.6.5"     testcompile "org.powermock:powermock-classloading-xstream:1.6.4"      compile project(':lp_messaging_sdk') } 

and here 3rd party library build.gradle

apply plugin: 'com.android.library'  android {     compilesdkversion 26     buildtoolsversion "26.0.1"      defaultconfig {         minsdkversion 14         targetsdkversion 26         versioncode 250         versionname "2.5.0"     }      flavordimensions "default"      productflavors {         snap {             ext.betadistributiongroupaliases = "internal"             ext.betadistributionreleasenotesfilepath = 'changelog.txt'             ext.betadistributionnotifications = true             dimension "default"         }          uat {             ext.betadistributiongroupaliases = "internal"             ext.betadistributionnotifications = true         }          production {          }     }      signingconfigs {         release {          }     }      buildtypematching 'snap', 'debug', 'release'      buildtypes {         debug {             applicationidsuffix '.debug'             minifyenabled true             testcoverageenabled false             buildconfigfield "string", "play_store_version_name", '"' + play_store_version_name + '"'             // workaround : https://code.google.com/p/android/issues/detail?id=212882             proguardfiles filetree(dir: 'proguard', include: ['*.pro']).aslist().toarray()             ext.enablecrashlytics = false         }          release {             minifyenabled true             testcoverageenabled = false             signingconfig signingconfigs.release             buildconfigfield "string", "play_store_version_name", '"' + play_store_version_name + '"'             // workaround : https://code.google.com/p/android/issues/detail?id=212882             proguardfiles filetree(dir: 'proguard', include: ['*.pro']).aslist().toarray()         }     }      defaultconfig {         consumerproguardfiles 'proguard.cfg'     }      repositories {         flatdir {             dirs 'aars'         }     }      lintoptions {         disable 'invalidpackage'     } }  dependencies {     compile 'com.android.support:appcompat-v7:26.0.1'     compile 'com.android.support:design:26.0.1'     compile 'com.android.support:recyclerview-v7:26.0.1'     compile 'com.android.support:percent:26.0.1'     compile 'com.android.support.constraint:constraint-layout:1.0.2'      compile 'com.squareup.picasso:picasso:2.5.2'     compile 'com.neovisionaries:nv-websocket-client:1.31'     compile 'com.squareup.okhttp3:okhttp:3.8.0'      compile(name: 'infra', ext: 'aar')     compile(name: 'messaging', ext: 'aar')     compile(name: 'messaging_ui', ext: 'aar')     compile(name: 'ui', ext: 'aar') } 

does know how can solve issue? thanks

try

compile project(path: ':lp_messaging_sdk', configuration: 'default')

explanation :

using dependency configurations make easy define , specify use in sub-project.

in answer used default configurations , publishes , exposes "release" build variant other android projects , modules.

assume need include project demo flavor, :

   android {    defaultpublishconfig "demo"  } 

and on, in case may use build flavors, , that's appeared in error log.

cannot choose between following configurations of project :lp_messaging_sdk 

and that's mean, lp_messaging_sdk have various build :-

  - debugapielements   - debugruntimeelements   - releaseapielements   - releaseruntimeelements 

and android-studio telling you, "i can't chose 1 configuration these various, define 1 me?"

you can read more on here.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -