【发布时间】:2018-09-13 20:22:21
【问题描述】:
我正在尝试在 Android 27 上构建一个应用程序,当我添加 android com.android.support:support-v4:27.1.0 和 com.google.firebase:firebase-messaging:12.0.1 依赖项时遇到问题。
我的项目 Gradle 文件如下所示 -
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我的 App build.gradle 文件看起来像这样 -
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.project.webinar"
minSdkVersion 26
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.google.firebase:firebase-messaging:12.0.1'
implementation 'com.google.android.gms:play-services-base:12.0.1'
implementation 'com.android.support:support-v13:27.1.0'
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.google.android.gms:play-services-places:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
}
apply plugin: 'com.google.gms.google-services'
在 Android Studio 3.1.0 上构建时出现以下错误 -
有人可以帮助我如何让 support-v4:27.1.0 为我的应用工作吗?
【问题讨论】:
-
您是否安装并更新了支持存储库?
-
@TimCastelijns 我的 SDK 管理器显示 Android 支持存储库已更新到版本 47.0.0。还有什么我想念的吗?
-
和谷歌存储库
-
@TimCastelijns Google Repository 已更新至版本 58
-
在您的根 build.gradle 文件的存储库部分中选择“google()”或“maven { url "maven.google.com" }”之一,它们执行相同的操作。
标签: android android-studio android-gradle-plugin build.gradle android-support-library