0

In my build.gradle file:

compile 'com.android.support:support-v4:[10.0.0,26.0.0['
compile 'com.android.support:appcompat-v7:[10.0.0,26.0.0['

Running gradle dependencies, shows:

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

I want to avoid including 26.0.0-alpha1... Why isn't gradle respecting ivy standard notation here?

Test project: https://github.com/benmarten/gradle-dependency-test

Ivy Standard: http://ant.apache.org/ivy/history/latest-milestone/settings/version-matchers.html

electronix384128
  • 6,625
  • 11
  • 45
  • 67

2 Answers2

1

Your version is wrong, 26.0.0 has not be released yet. Check the versions you have locally:

$ 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

Since 26.0.0-alpha1 is out but 26.0.0 is not, you will need to use +. This works for me with 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.+['
}

Possibly unrelated to your question but your project does not compile:

/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

It turns out, it is your minSdkVersion version. In your app/build.gradle, set your minSdkVersion to 14:

android {
    defaultConfig {
        minSdkVersion 14
    }
}
Jared Burrows
  • 54,294
  • 25
  • 151
  • 185
  • 1
    Thanks! As suggested using: `[10.0.0,26.+[` solved it! The reason you were seeing this error is because of version 26 bumping the minSDKVersion, which I want to avoid by excluding 26 – electronix384128 Apr 24 '17 at 23:59
1

compileSdkVersion 26 Release Now

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'
Keshav Gera
  • 10,807
  • 1
  • 75
  • 53