Reputation: 684
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
Upvotes: 3
Views: 773
Reputation: 363845
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"
}
Upvotes: 1
Reputation: 5302
These all constants are defined in constants.gradle
file
Example of constants.gradle
project.ext {
compileSdk = 26
targetSdk = 26
minSdk = 14
buildTools = '26.0.1'
firebaseVersion = '11.2.0'
supportLibraryVersion = '26.0.1'
playServiesVersion = '11.2.0'
}
You have to add constants.gradle file directly under project directory and add
apply from: 'constants.gradle'
in build.gradle
of project.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: 'constants.gradle'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Upvotes: 1