Google 和 Firebase 依赖项在 Android Studio 更新后未解析
Google and Firebase dependencies not resolving after Android Studio update
我最近在 Ubuntu 17.04 上将 Android studio 从 2.1 更新到 2.3.3。此外,我必须将我的 android.support 依赖项从版本 25.0.0 更新到 26.0.1,并将我的 firebase 依赖项从 9.6.1 更新到 11.2.0。我在 SO 上尝试了所有方法都无济于事,包括完全重新成像 ubuntu。所有 google/firebase 依赖项仍然无法解决,所以这一定是我这边的错误。下面是我的 gradle 个文件。
模块build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "me.myapp.app"
minSdkVersion 15
targetSdkVersion 26
versionCode 10
versionName "0.10.1"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-crash:11.2.0'
compile 'com.google.firebase:firebase-storage:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
}
apply plugin: 'com.google.gms.google-services'
项目build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// 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
}
尝试添加
maven {
url "https://maven.google.com"
}
在 jcenter() 之后
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
我最近在 Ubuntu 17.04 上将 Android studio 从 2.1 更新到 2.3.3。此外,我必须将我的 android.support 依赖项从版本 25.0.0 更新到 26.0.1,并将我的 firebase 依赖项从 9.6.1 更新到 11.2.0。我在 SO 上尝试了所有方法都无济于事,包括完全重新成像 ubuntu。所有 google/firebase 依赖项仍然无法解决,所以这一定是我这边的错误。下面是我的 gradle 个文件。
模块build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "me.myapp.app"
minSdkVersion 15
targetSdkVersion 26
versionCode 10
versionName "0.10.1"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.google.firebase:firebase-core:11.2.0'
compile 'com.google.firebase:firebase-database:11.2.0'
compile 'com.google.firebase:firebase-auth:11.2.0'
compile 'com.google.firebase:firebase-crash:11.2.0'
compile 'com.google.firebase:firebase-storage:11.2.0'
compile 'com.google.firebase:firebase-messaging:11.2.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
}
apply plugin: 'com.google.gms.google-services'
项目build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// 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
}
尝试添加
maven {
url "https://maven.google.com"
}
在 jcenter() 之后
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}