2

I am trying to add Firebase Analytics to my Android Studio project.

I am getting the following error:

all firebase libraries must be either above or below 14.0.0

I have already been seeing this question that has a solution but I tried similar changes and is not working still.

Here is my (module: app) build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.1"
    useLibrary  'org.apache.http.legacy'

    defaultConfig {
        applicationId "my-application-id"
        minSdkVersion 9
        targetSdkVersion 23
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
       }
    }


    dependencies {

        compile 'com.android.support:appcompat-v7:23.4.0'
        compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.0'
        compile 'com.google.android.gms:play-services:8.4.0'
        compile 'com.navercorp.pulltorefresh:library:3.2.0@aar'

    }
}

dependencies {
    compile 'com.google.firebase:firebase-core:15.0.0'
}

repositories {
    maven {url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
}

apply plugin: 'com.google.gms.google-services'

And here is my (project) build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.3.0' // google-services plugin
    }
}

allprojects {
    repositories {
        jcenter()

        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

Thank you in advance for your help.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
P. Vera
  • 315
  • 4
  • 11

1 Answers1

2

To solve this, please move the following line of code:

compile 'com.google.firebase:firebase-core:15.0.0'

In the above dependencies section and change it to:

compile 'com.google.firebase:firebase-core:16.0.1'

If you also want to use Analytics, please also add the following line of code:

com.google.firebase:firebase-analytics:16.0.1

To make it work, change also the followin line of code:

classpath 'com.google.gms:google-services:3.3.0'

to

classpath 'com.google.gms:google-services:4.0.1'
Alex Mamo
  • 130,605
  • 17
  • 163
  • 193