Flavor specific compile fileTree to include different .jar files

591 Views Asked by At

I`m using com.android.tools.build:gradle-experimental:0.6.0-alpha3 plugin in my project. My Build gradle looks like:

apply plugin: 'com.android.model.application'

model {

    android {
        compileSdkVersion = 19
        buildToolsVersion = "19.1.0"

        defaultConfig.with {
            applicationId = "com.my.company"
            minSdkVersion.apiLevel = 9
            targetSdkVersion.apiLevel = 19
            versionCode = 2
            versionName = "0.0.4"

        }
    }

    android.ndk {
        moduleName = "native"
        stl = "gnustl_static"
        cppFlags.add("-I" + file("../../src").absolutePath)

        cppFlags.add("-std=gnu++11")
        cppFlags.add("-fexceptions")
        cppFlags.add("-frtti")
        ldLibs.add("log")
        ldLibs.add("GLESv2")
        ldLibs.add("android");
    }

    android.sources {
        main {
            assets {
                source {
                    srcDir "../../assets"
                }
            }
            res {
                source {
                    srcDirs = ['../../res']
                }
            }
            jni {
                source {
                    srcDir "../../src"
                }
            }
        }
    }


    android.buildTypes {
        release {
            minifyEnabled = false
            proguardFiles.add(file("proguard-rules.pro"))

        }
    }

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

        create("google") {
            ndk.abiFilters.add("armeabi")
            ndk.abiFilters.add("armeabi-v7a")
        }
        create("amazon") {
            ndk.abiFilters.add("armeabi")
            ndk.abiFilters.add("armeabi-v7a")
        }
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])

}

I need to include different .jar files for Google Play Store and Amazon Store Apps. I`ve added 2 flavours with names google and amazon accordingly, and added 2 lines to my dependencies block:

dependencies {
        compile 'com.android.support:support-v4:19.1.0'
        compile fileTree(dir: 'libs', include: ['*.jar'])
        googleCompile fileTree(dir: 'libs/google', include: ['*.jar'])
        amazonCompile fileTree(dir: 'libs/amazon', include: ['*.jar'])
    }

The problem is that after this changes i`ve got procen project due to gradle cannot parse and is giving the error: Gradle DSL method not found: 'googleCompile()'

Can anyone help me or head for the right way of the research of the problem. Thank you.

0

There are 0 best solutions below