我已将cordova-plugin-firebase插件包含到我的项目中,并且在Android上构建时遇到困难(ios可以)。
$ cordova插件添加cordova-plugin-firebase --save $离子cordova平台添加android 打开android studio-同步gradle,然后出现以下错误
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
仅供参考,以下是一些项目详细信息
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
这是我的build.gradle文件gist.github.com/axilaris/39a22849a649c60bcce079b67d4bb638
如何为Android解决此问题?
答案 0 :(得分:4)
可以在这里找到答案
Gradle build tool cannot find play-services-tasks.aar? Why?
https://issuetracker.google.com/issues/80362794
解决方法是将Google网址放在gradle的存储库列表中jcenter()上方。 这是问题所在:https://issuetracker.google.com/issues/80362794
基本上,以下是我在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()
}
}