javascript - 找不到 play-services-tasks-license.aar (com.google.android.gms:play-services-tasks-license:11.8.0)
问题描述
尽管我进行了研究,但我无法弄清楚问题所在。请帮帮我。我在哪里出错?我已经分享了以下所有信息。我尝试了所有方法,但无法解决问题。
build.gradle 文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
def googlePlayServicesVersion = '11.8.0'
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
def versionOverrides = [
"com.facebook.android:facebook-android-sdk": "4.22.1",
]
project(':react-native-fbsdk') {
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.22.1'
}
}
}
allprojects {
repositories {
// Add jitpack repository (added by tipsi-stripe)
maven { url "https://jitpack.io" }
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
configurations.all {
resolutionStrategy {
// react-native-admob
force "com.google.android.gms:play-services-ads:$googlePlayServicesVersion"
// react-native-onesignal
force "com.google.android.gms:play-services-gcm:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-analytics:$googlePlayServicesVersion"
force "com.google.android.gms:play-services-location:$googlePlayServicesVersion"
force 'com.facebook.android:facebook-android-sdk:4.22.1'
}
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def overrideVersion = versionOverrides[details.requested.group + ":" + details.requested.name]
if (overrideVersion != null && details.requested.version != overrideVersion) {
println("********************************************************")
println("Overriding dependency ${details.requested.group}:${details.requested.name} version ${details.requested.version} --> $overrideVersion")
details.useVersion overrideVersion
println("********************************************************")
}
}
}
}
subprojects {
afterEvaluate {
project -> if (project.hasProperty("android")) {
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
}
}
}
}
React-Native run-android 错误:
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-onesignal'.
> Could not find play-services-tasks-license.aar (com.google.android.gms:play-services-tasks-license:11.8.0).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-tasks-license/11.8.0/play-services-tasks-license-11.8.0.aar
解决方案
JCenter 不提供https://jcenter.bintray.com/com/google/android/gms/play-services-tasks-license/11.8.0/play-services-tasks-license-11.8.0.aar
. 这样做:
maven { https://maven.google.com/ }
交换 jcenter() 并重maven { url "https://maven.google.com" }
试。
构建.gradle
allprojects {
repositories {
mavenLocal()
maven {
url "https://maven.google.com"
}
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
configurations.all {
resolutionStrategy {
force 'com.facebook.android:facebook-android-sdk:4.31.0'
force 'com.google.android.gms:play-services-base:11.8.0'
force 'com.google.android.gms:play-services-maps:11.8.0'
force 'com.google.android.gms:play-services-gcm:11.8.0'
force 'com.google.android.gms:play-services-location:11.8.0'
}
}
}
}
推荐阅读
- node.js - 如何使用 Express 和 Node 创建一个简单的用户配置文件 URL?
- java - ScrollPane JavaFX 中图形上的静态标签
- java - 从 docx 转换为 html 时,Apache Tika 不保留 Html 标记属性
- ios - 如何为 AVSpeechSynthesizer 音频生成波形?
- android - 如何让我的操作栏有溢出的图标
- html - ReplaceAll 使用 Java 和 HTML - 更改颜色
- ruby-on-rails - Heroku 数据库设置
- ios - 方法不能声明为 public,因为它的参数使用了内部类型
- windows - 谷歌云 SDK 安装中的 gcloud beta 模拟器数据存储启动错误
- java - 尝试在空对象引用上调用接口方法“java.lang.Object java.util.Map$Entry.getValue()”