Reputation: 2755
I am having issues while running 'gradlew lint' on my Android Library Project since I upgraded my gradle wrapper version and build tools version.
I was previously using gradlew version 1.3.0 and buildToolsVersion of 23.0.0 I had no issues while running lint.
After upgrading my gradlew version and buildTools versions, I started having this error while running 'gradlew lint'
I am using gradlew version
classpath 'com.android.tools.build:gradle:2.3.3'
Then on my build.gradle (app) I am using
compileSdkVersion 25
buildToolsVersion '25.0.0'
My play-services version is
compile 'com.google.android.gms:play-services:8.1.0'
From the lint results this is the error ouput
Incompatible Gradle Versions
../../build.gradle: All com.android.support libraries must use
the exact same version specification
(mixing versions can lead to runtime crashes).
Found versions 26.0.0-alpha1, 22.2.0.
Examples include com.android.support:support-compat:26.0.0-alpha1
and com.android.support:appcompat-v7:22.2.0
I have a gut feeling that this is issue is caused by play-services and android buildTools version however I don't have an idea on how to fix it.
Now when I run './gradlew -q dependencies app:dependencies --configuration compile'
I get this from the play-services section
+--- com.google.android.gms:play-services:8.1.0
| +--- com.google.android.gms:play-services-ads:8.1.0
| | +--- com.google.android.gms:play-services-basement:8.1.0
| | | \--- com.android.support:support-v4:22.2.0 -> 26.0.0-alpha1
| | | +--- com.android.support:support-compat:26.0.0-alpha1
| | | | \--- com.android.support:support-annotations:26.0.0-alpha1 -> 23.0.1
| | | +--- com.android.support:support-media-compat:26.0.0-alpha1
| | | | +--- com.android.support:support-annotations:26.0.0-alpha1 -> 23.0.1
| | | | \--- com.android.support:support-compat:26.0.0-alpha1 (*)
| | | +--- com.android.support:support-core-utils:26.0.0-alpha1
| | | | +--- com.android.support:support-annotations:26.0.0-alpha1 -> 23.0.1
| | | | \--- com.android.support:support-compat:26.0.0-alpha1 (*)
| | | +--- com.android.support:support-core-ui:26.0.0-alpha1
| | | | +--- com.android.support:support-annotations:26.0.0-alpha1 -> 23.0.1
| | | | \--- com.android.support:support-compat:26.0.0-alpha1 (*)
| | | \--- com.android.support:support-fragment:26.0.0-alpha1
| | | +--- com.android.support:support-compat:26.0.0-alpha1 (*)
| | | +--- com.android.support:support-core-ui:26.0.0-alpha1 (*)
| | | \--- com.android.support:support-core-utils:26.0.0-alpha1 (*)
Note : I only displayed the play-services part as this is what I saw from the Lint Results and I think this is the only part that would be useful.
can anyone tell me what play-services version should I be using with buildToolsVersion 25 and compiledSdkVersion 25?
Thanks!
app build.gradle
import com.android.build.gradle.LibraryPlugin
import org.aspectj.bridge.IMessage
import org.aspectj.bridge.MessageHandler
import org.aspectj.tools.ajc.Main
apply plugin: 'com.android.library'
android {
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
}
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 19
targetSdkVersion 25
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
debug {
buildConfigField "String", "APP_VERSION", "\"1.0-SNAPSHOT\""
}
release {
buildConfigField "String", "APP_VERSION", "\"1.0-SNAPSHOT\""
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-rules-app.pro'
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:23.0.1'
}
}
sourceSets {
defaultConfig {
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
}
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'org.aspectj:aspectjtools:1.8.9'
}
}
repositories {
maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
maven {
url "https://maven.java.net/content/groups/public/"
}
}
apply plugin: 'com.neenbedankt.android-apt'
def dbflow_version = "3.1.1"
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.squareup.okhttp3:okhttp:3.0.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.0.1'
apt "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}"
compile "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}"
compile "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}"
compile 'com.github.Raizlabs.DBFlow:dbflow-sqlcipher:3.1.1@aar'
compile 'net.zetetic:android-database-sqlcipher:3.5.1'
compile 'org.xerial:sqlite-jdbc:3.7.2'
compile 'commons-io:commons-io:2.4'
compile 'commons-collections:commons-collections:3.2.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.guava:guava:18.0'
compile 'com.scottyab:aescrypt:0.0.1'
compile([group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.3.2'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.3.2'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.3.2'])
compile 'org.aspectj:aspectjrt:1.8.9'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.slf4j:slf4j-api:1.7.21'
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
exclude group: 'com.google.android', module: 'android'
}
compile 'com.sun.mail:android-mail:1.5.5'
compile 'com.sun.mail:android-activation:1.5.5'
compile 'org.xwalk:xwalk_core_library:20.50.533.12'
testCompile 'junit:junit:4.12'
testCompile group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '3.9.0'
testCompile 'org.powermock:powermock:1.6.5'
testCompile 'org.powermock:powermock-module-junit4:1.6.5'
testCompile 'org.powermock:powermock-api-mockito:1.6.5'
testCompile 'org.robolectric:robolectric:3.0'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
}
Upvotes: 2
Views: 1587
Reputation: 365028
Found versions 26.0.0-alpha1, 22.2.0. Examples include com.android.support:support-compat:26.0.0-alpha1 and com.android.support:appcompat-v7:22.2.0
You are using libraries with different version of support libraries.
In particolar you are using com.android.support:appcompat-v7:22.2.0
and com.android.support:support-compat:26.0.0-alpha1
.
Update to latest version in particolar way use the support libraries v.26 and the google play services libraries v.11.2.0.
compile 'com.google.android.gms:play-services:8.1.0'
Also keep in mind that the support libraries v26 and google play services v.11.2.0 require compileSdkVersion 26
and the google maven repo url "https://maven.google.com"
.
If you would like to exclude com.android.support
library you can use:
compile ('com.google.android.gms:play-services:11.2.2'){
exclude group: 'com.android.support'
}
Upvotes: 2
Reputation: 192023
As you can see, Google Play Services is picking a version that's older than what you want for support-v4
+--- com.google.android.gms:play-services:8.1.0
| +--- com.google.android.gms:play-services-ads:8.1.0
| | +--- com.google.android.gms:play-services- basement:8.1.0
| | | \--- com.android.support:support-v4:22.2.0
what play-services version should I be using with buildToolsVersion 25 and compiledSdkVersion 25?
Those numbers don't really matter all that much. But you'll ideally always want to have the latest compile SDK (depending on resource or method deprecation and removals) and Build tools. At least, I've never had a problem with that approach.
As for Google Play, go read the documentation. Specifically the section on selectively compiling what you actually need
Upvotes: 0