Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add explicit declaration in gradle android

compile "com.google.firebase:firebase-auth:$FOO"
compile "com.google.android.gms:play-services-auth:$FOO"

compile "com.android.support:design:$BAR"
compile "com.android.support:customtabs:$BAR"
compile "com.android.support:cardview-v7:$BAR"

I need to add explicit compile declarations in your build.gradle. This link says https://github.com/firebase/FirebaseUI-Android#installation to put this codes to avoid the conflicts . but Android studio says FOO,BAR is not found. Help me

like image 516
Sathiyakugan Avatar asked Jan 28 '26 06:01

Sathiyakugan


1 Answers

FOO and BAR are just variables defined in a .gradle file.
You can call them as you want.

To use this kind of syntax you can define in your top-level build.gradle something like:

project.ext { 
    firebaseVersion = '11.2.0'
    supportLibraryVersion = '26.0.1'
}

and then use these variables in another part of your module build.gradle file, for example in the dependencies.

For example:

dependencies {
    compile "com.android.support:design:$supportLibraryVersion"
    compile "com.google.android.gms:play-services-auth:$firebaseVersion"
}

Or if you prefer to use FOO and BAR

project.ext { 
        FOO = '11.2.0'
        BAR = '26.0.1'
    }

 dependencies {
        compile "com.android.support:design:$BAR"
        compile "com.google.android.gms:play-services-auth:$FOO"
    }
like image 142
Gabriele Mariotti Avatar answered Jan 30 '26 20:01

Gabriele Mariotti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!