2

I have included cordova-plugin-firebase plugin into my project and having difficult with build on Android (ios is ok).

$ cordova plugin add cordova-plugin-firebase --save $ ionic cordova platform add android open android studio - synch gradle then below error appear

Error:Could not find play-services-base.jar (com.google.android.gms:play-services-base:15.0.1).
Searched in the following locations:
    https://jcenter.bintray.com/com/google/android/gms/play-services-base/15.0.1/play-services-base-15.0.1.jar

enter image description here

FYI, here are some project details

Im using ionic version 1
"cordova-android": "~6.3.0",
in build.gradle: classpath 'com.android.tools.build:gradle:2.2.3'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START
    debugCompile(project(path: "CordovaLib", configuration: "debug"))
    releaseCompile(project(path: "CordovaLib", configuration: "release"))
    compile "com.android.support:support-v4:24.1.1+"
    compile "com.google.gms:google-services:+"
    compile "com.google.android.gms:play-services-tagmanager:+"
    compile "com.google.firebase:firebase-core:+"
    compile "com.google.firebase:firebase-messaging:+"
    compile "com.google.firebase:firebase-crash:+"
    compile "com.google.firebase:firebase-config:+"
    compile "com.google.firebase:firebase-perf:+"
    compile "com.android.support:appcompat-v7:23+"
    compile "com.onesignal:OneSignal:3.9.1"
    // SUB-PROJECT DEPENDENCIES END
}

in the Android SDK Manager -> SDK Tools. Google Play Services version 49 is installed https://imgur.com/a/qR29lbL

this is my build.gradle file gist.github.com/axilaris/39a22849a649c60bcce079b67d4bb638

How can I solve this for android ?

9
  • What is your tools build gradle version? I think you should add google() in your project's root build.gradle -> buildscript&allprojects->repositories{}. Commented Jun 20, 2018 at 7:56
  • Im not sure what you mean, i added some info above. it has this: classpath 'com.android.tools.build:gradle:2.2.3' Commented Jun 20, 2018 at 7:58
  • I think it is a maven repo issue. the play-services-base.jar should be download in google maven not in the jcenter. perhapse you can add maven { url 'https://maven.google.com' } instead google(). Commented Jun 20, 2018 at 8:01
  • this is my build.gradle. gist.github.com/axilaris/39a22849a649c60bcce079b67d4bb638 I think its the same as what you mentioned. Commented Jun 20, 2018 at 8:05
  • is it something to do with this dependencies - compile "com.google.gms:google-services:+" Commented Jun 20, 2018 at 9:40

1 Answer 1

4

The answer can be found here:

Gradle build tool cannot find play-services-tasks.aar? Why?

https://issuetracker.google.com/issues/80362794

The fix is to put google url above jcenter() in your repository list in gradle. Here's the issue: https://issuetracker.google.com/issues/80362794

Basically, below was my fix to work in build.gradle

buildscript {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()

    }

    // Switch the Android Gradle plugin version requirement depending on the
    // installed version of Gradle. This dependency is documented at
    // http://tools.android.com/tech-docs/new-build-system/version-compatibility
    // and https://issues.apache.org/jira/browse/CB-8143
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        maven {
            url "https://maven.google.com"
        }
        jcenter()

    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.