Android 未能解决:播放服务任务许可证(将google()放在jcenter()之前不起作用)
每当我尝试运行我的应用程序时,我都会出现以下gradle错误: 未能解析:播放服务任务许可证 根据问题,我已经尝试了所有可能的解决方案,但没有一个奏效 如果我将google()放在依赖项的第一行,错误仍然会出现。 如果可以的话,请帮忙 我的应用程序级别build.gradle文件:Android 未能解决:播放服务任务许可证(将google()放在jcenter()之前不起作用),android,android-gradle-plugin,google-play-services,Android,Android Gradle Plugin,Google Play Services,每当我尝试运行我的应用程序时,我都会出现以下gradle错误: 未能解析:播放服务任务许可证 根据问题,我已经尝试了所有可能的解决方案,但没有一个奏效 如果我将google()放在依赖项的第一行,错误仍然会出现。 如果可以的话,请帮忙 我的应用程序级别build.gradle文件: buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependenc
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
minSdkVersion 19
applicationId 'com.myapppackage.app'
targetSdkVersion 26
versionCode 77
versionName '1.5.53'
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'io.appflate.restmock.android.RESTMockTestRunner'
}
}
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:design:26.0.2'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.android.gms:play-services-gcm:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.android.gms:play-services-base:11.8.0'
implementation files('libs/youtube.jar')
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的项目级渐变文件:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
defaultConfig {
minSdkVersion 19
applicationId 'com.myapppackage.app'
targetSdkVersion 26
versionCode 77
versionName '1.5.53'
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'io.appflate.restmock.android.RESTMockTestRunner'
}
}
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:design:26.0.2'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.android.gms:play-services-gcm:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.android.gms:play-services-base:11.8.0'
implementation files('libs/youtube.jar')
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我认为您需要更改项目级别
build.gradle
文件,如下所示:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
把这个拿走
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
还有这个
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
从应用程序build.gradle
文件
PS:您也可以删除实现文件('libs/youtube.jar')
,因为您已经在导入带有以下行的库:实现文件树(包括:['*.jar'],dir:'libs')
我认为您需要更改项目级别
build.gradle
文件,如下所示:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
把这个拿走
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
还有这个
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
从应用程序build.gradle
文件
PS:您也可以删除实现文件('libs/youtube.jar')
,因为您已经在导入带有以下行的库:实现文件树(包括:['*.jar'],dir:'libs')