在我的build.gradle文件中:
compile 'com.android.support:support-v4:[10.0.0,26.0.0['
compile 'com.android.support:appcompat-v7:[10.0.0,26.0.0['
正在运行gradle dependencies
,显示:
sourcesReleaseCompile - Classpath for compiling the sourcesRelease sources.
+--- project :MyProject
| +--- com.android.support:support-v4:[10.0.0,26.0.0[ -> 26.0.0-alpha1
[...]
| \--- com.android.support:appcompat-v7:[10.0.0,26.0.0[ -> 26.0.0-alpha1
我想避免包括26.0.0-alpha1 ...为什么我们不遵守常春藤标准符号呢?
测试项目:https://github.com/benmarten/gradle-dependency-test
常春藤标准:http://ant.apache.org/ivy/history/latest-milestone/settings/version-matchers.html
答案 0 :(得分:1)
26.0.0
尚未发布。检查您在本地的版本:$ ls ~/android-sdk/extras/android/m2repository/com/android/support/appcompat-v7/
18.0.0/ 22.1.1/ 23.4.0/ 25.0.1/
19.0.0/ 22.2.0/ 24.0.0/ 25.1.0/
19.0.1/ 22.2.1/ 24.0.0-alpha1/ 25.1.1/
19.1.0/ 23.0.0/ 24.0.0-alpha2/ 25.2.0/
20.0.0/ 23.0.1/ 24.0.0-beta1/ 25.3.0/
21.0.0/ 23.1.0/ 24.1.0/ 25.3.1/
21.0.2/ 23.1.1/ 24.1.1/ 26.0.0-alpha1/
21.0.3/ 23.2.0/ 24.2.0/ maven-metadata.xml
22.0.0/ 23.2.1/ 24.2.1/ maven-metadata.xml.md5
22.1.0/ 23.3.0/ 25.0.0/ maven-metadata.xml.sha1
由于26.0.0-alpha1
已经用完,但26.0.0
没有,因此您需要使用+
。这适用于Gradle 3.5
:
dependencies {
compile 'com.android.support:support-v4:[10.0.0,26.0.+['
compile 'com.android.support:appcompat-v7:[10.0.0,26.0.+['
}
/Users/<>/repo/gradle-dependency-test/app/src/main/AndroidManifest.xml Error:
uses-sdk:minSdkVersion 10 cannot be smaller than version 14 declared in library [com.android.support:appcompat-v7:26.0.0-alpha1] /Users/<>/.android/build-cache/72b0bd3c930a8826bf341b591250d185129357b9/output/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:app:processDebugManifest FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version 14 declared in library [com.android.support:appcompat-v7:26.0.0-alpha1] /Users/<>/.android/build-cache/72b0bd3c930a8826bf341b591250d185129357b9/output/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="android.support.v7.appcompat" to force usage
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.136 secs
事实证明,这是您的minSdkVersion
版本。在app/build.gradle
中,将minSdkVersion
设置为14
:
android {
defaultConfig {
minSdkVersion 14
}
}
答案 1 :(得分:1)
compileSdkVersion 26立即发布
Setting up Gradle for api 26 (Android)
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.keshav.retroft2arrayinsidearrayexamplekeshav"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:recyclerview-v7:26.0.1'
compile 'com.android.support:cardview-v7:26.0.1'