【发布时间】:2018-10-16 14:18:16
【问题描述】:
在 Android Studio 2.3 中:
应用程序构建.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "my.test"
minSdkVersion 11
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 {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0'
compile 'com.android.support:support-v4:27.0'
testCompile 'junit:junit:4.12'
}
root build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
虽然我明确添加了 Google maven 存储库,但结果是支持库未解析:
错误:(27, 13) 无法解决: com.android.support:support-v4:27.0 ... 错误:(26, 13) 无法解决:com.android.support:appcompat-v7:27.0 ...
【问题讨论】:
-
请添加您的整个 build.gradle 代码。
标签: android gradle android-support-library