Could not resolve library project after upgrade to Android 3.0 beta 2 -


i trying upgrade latest beta2 , encounter following issues app , lib modules.

in app build.gradle have 2 flavors

    flavordimensions "default"         productflavors {            stage {              applicationid "com.mycompany.hello.stage"              resvalue "string", "app_name", "stage"             }            production {             applicationid "com.mycompany.hello.stage.production"             resvalue "string", "app_name", "live"             }       } 

and specify app talk specific type of lib following:

 stagecompile project(path: ':lib', configuration: 'debug')  productioncompile project(path: ':lib', configuration: 'release') 

lib build.gradle file have build types , no flavor block

 publishnondefault true  buildtypes {     debug {         versionnamesuffix ".debug"     }     release {         versionnamesuffix ".release"         minifyenabled true     } } 

above code best knowledge app depends on build variant , talk particular build variants of lib. works until upgraded 3.0.

here gradle error message...i not sure if caused flavordimensions mismatches in 2 gradle files.

error:could not determine dependencies of task ':app:compilestagedebugaidl'. > not resolve task dependencies configuration ':app:stagedebugcompileclasspath'. > not resolve project :lib.  required project :app > project :app declares dependency configuration 'stagecompile' configuration 'debug' not declared in descriptor project :lib. 

so spent couple of hours , migrated project match migrating guide provided android studio.

i end doing following changes achieve want:

app variant productionrelease should invoke lib release

app variant stagedebug should invoke lib debug

app build.gradle file

flavordimensions "default" //add line flavordimensions  productflavors {     stage {         ...     }      production {         ...     } } implementation project(':lib') 

in lib build.gradle remain same

publishnondefault true  buildtypes {     debug {         versionnamesuffix ".debug"     }     release {         versionnamesuffix ".release"         minifyenabled true     } } 

the catch have here ignore variants don't want achieve productionrelease(app)+release(lib) , stagedebug(app)+debug(lib) combinations.

// in way have productionrelease , stagedebug variant left in panel me.

in app build.gradle

variantfilter { variant ->     def names = variant.flavors*.name     if (names.contains("stage") && variant.buildtype.name == "release") {         variant.ignore = true     }     if (names.contains("production") && variant.buildtype.name == "debug") {         variant.ignore = true     } } 

when switch build variants of app, switch lib corresponding build type.

i still no sure if best practice. if guys find better way it. please let me know.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -