How to refer to build variants in gradle experimental

741 views
Skip to first unread message

par...@gmail.com

unread,
Jan 18, 2016, 11:35:03 AM1/18/16
to android-ndk
Gradle for library project compiles it using Release even though you are building the app in debug. 

So it ends up using NDEBUG even on the debug builds in the Library modules


There is a work around #60
dependencies {
    flavorDebugCompile project
(path: ':custom_lib', configuration: "libraryDebug")
    flaveorReleaseCompile project
(path: ':custom_lib', configuration: "libraryRelease")
}

But in Experimental they have changed the syntax of gradle files, including creating flavours

when I try 
dependencies {
    flavorDebugCompile project
([path: ':custom_lib', configuration: "libraryDebug"])


It gives the following error:
flavorDebugCompile method not found

par...@gmail.com

unread,
Jan 19, 2016, 1:40:51 AM1/19/16
to android-ndk


# the solution number should be #37, #60 is derivation of #37  

Adrian Ivasku

unread,
Jan 24, 2016, 6:25:58 PM1/24/16
to android-ndk
I use it like this, with experimental 0.4.0.

android.productFlavors {   
create("arm") {
ndk.abiFilters.add("armeabi")
}
create("arm7") {
ndk.abiFilters.add("armeabi-v7a")
}
create("arm8") {
ndk.abiFilters.add("arm64-v8a")
}

create("googleFree") {
applicationId = "com.test.free"
}

create("googleFull") {
applicationId = "com.test.full"
}

Raymond Chiu

unread,
Jan 25, 2016, 2:45:23 PM1/25/16
to android-ndk
Configuration dependencies do not work very well with the experimental plugin.  The workaround is to create the configuration first.  E.g.

configurations {
    flavorDebugCompile
}

par...@gmail.com

unread,
Feb 18, 2016, 10:19:52 AM2/18/16
to android-ndk
How would you call the configuration in Android Studio as an option in the Build Variant menu?

Igor Ganapolsky

unread,
Sep 22, 2016, 2:34:15 PM9/22/16
to android-ndk
Where exactly do you put this configurations { } block?

Raymond Chiu

unread,
Sep 23, 2016, 3:27:06 PM9/23/16
to android-ndk
In the build.gradle for the app,
Before setting the dependencies:
configurations {
    flavorDebugCompile
    flavorReleaseCompile
}
dependencies {
    flavorDebugCompile project
(path: ':custom_lib', configuration: "libraryDebug")

    flavorReleaseCompile project
(path: ':custom_lib', configuration: "libraryRelease")
Reply all
Reply to author
Forward
0 new messages