I have added
classpath 'com.google.gms:google-services:4.0.0'
to project level gradle file inside buildscript/dependencies.
I have also added
compile 'com.google.firebase:firebase-core:16.0.1'
to app level gradle file inside dependencies
I have also added the google-services.json
file to app folder.
I have also added apply plugin: 'com.google.gms.google-services'
to the top of app gradle file. (Tutorial says bottom, but I have also fabric's at the top, I don't think it's a problem, I have also tested at the bottom with same result)
When I try to run the project, I got this error:
Error:Execution failed for task ':app:processBetaDebugManifest'.
Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.2) from [com.android.support:recyclerview-v7:26.0.2] AndroidManifest.xml:25:13-35 is also present at [com.android.support:support-v4:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:23:9-25:38 to override.
Why could this be? I have changed nothing else, just added Firebase as official sources described.
I don't want to use tools:replace
in my manifest, it has led me to many bugs in the past. It feels like a half solution or a quick fix.
E D I T:
Project level gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App level gradle file:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 19
targetSdkVersion 26
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
debuggable false
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// Specifies a flavor dimensions. Must have at least one.
flavorDimensions "myFlavorDimension"
productFlavors {
beta {
applicationId "hu.adamvarhegyi.myproject.beta"
versionCode 12
versionName '1.0.94 beta'
}
//Release
standard {
applicationId "hu.adamvarhegyi.myproject"
versionCode 12
versionName '1.0.94'
}
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
def project = "my_project"
def SEP = "_"
def buildType = variant.variantData.variantConfiguration.buildType.name
def versionName = variant.versionName
def versionCode = "(v_" + variant.versionCode + ")"
def date = new Date();
def formattedDate = date.format('yyyy-MM-dd-HH-mm')
def newApkName = project + SEP + buildType + SEP + versionName + SEP + versionCode + SEP + formattedDate + ".apk"
outputFileName = new File(newApkName)
}
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
transitive = true;
}
compile project(':gameanalytics')
compile 'com.google.android.gms:play-services-basement:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile('com.android.support:appcompat-v7:26.0.2')
compile('com.android.support:recyclerview-v7:26.0.2')
compile 'com.android.support:gridlayout-v7:26.0.2'
compile('com.makeramen:roundedimageview:2.2.1')
compile('de.hdodenhof:circleimageview:2.1.0')
compile 'com.squareup.okio:okio:1.13.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.github.javiersantos:PiracyChecker:1.2.3'
compile 'com.google.firebase:firebase-core:16.0.1'
compile(name: 'my_project_engine', ext: 'aar')
}