From db01788ee9a562711395ea5022a0141e5b882579 Mon Sep 17 00:00:00 2001 From: Marcos Trujillo Date: Mon, 23 Jul 2018 18:38:00 +0200 Subject: [PATCH] Update gradle files according new Android Gradle plugin 3.0 Please, review this tutorial for a better understanding of this commit: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration Apply this new rules to the gradle files, changing compile by implementation and adding annotationProcessor. Also, edit the order of the repositories jcenter() and google() to avoid download dependencies errors. --- .travis.yml | 14 +++++++++++--- build.gradle | 4 ++-- rosie/build.gradle | 17 +++++++++-------- sample/build.gradle | 44 +++++++++++++++++++++++--------------------- 4 files changed, 45 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index 72ed1578..233169b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,22 @@ language: android +before_install: + - mkdir "$ANDROID_HOME/licenses" || true + - echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license" + - echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license" + android: components: - platform-tools - tools - - build-tools-23.0.3 - - android-23 + - build-tools-27.0.3 + - android-27 - extra-android-support - extra-google-m2repository - extra-android-m2repository + licenses: + - android-sdk-license-.+ + - '.+' script: - - ./gradlew checkstyle build -Dpre-dex=false -Pcom.android.build.threadPoolSize=1 -Dorg.gradle.parallel=false -Dorg.gradle.jvmargs="-Xms512m -Xmx512m" -Dorg.gradle.daemon=false \ No newline at end of file + - ./gradlew checkstyle build -Dpre-dex=false -Pcom.android.build.threadPoolSize=1 -Dorg.gradle.parallel=false -Dorg.gradle.jvmargs="-Xms512m -Xmx512m" -Dorg.gradle.daemon=false diff --git a/build.gradle b/build.gradle index 68d95c56..86b7a76d 100644 --- a/build.gradle +++ b/build.gradle @@ -16,8 +16,8 @@ buildscript { repositories { - jcenter() google() + jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' @@ -34,8 +34,8 @@ ext { allprojects { repositories { mavenCentral() - jcenter() google() + jcenter() } apply plugin: 'checkstyle' diff --git a/rosie/build.gradle b/rosie/build.gradle index e51bb8f4..2f4c75bd 100644 --- a/rosie/build.gradle +++ b/rosie/build.gradle @@ -28,16 +28,17 @@ android { } dependencies { - compile 'com.android.support:appcompat-v7:23.4.0' - compile 'com.android.support:recyclerview-v7:23.4.0' + implementation 'com.android.support:appcompat-v7:23.4.0' + implementation 'com.android.support:recyclerview-v7:23.4.0' - provided 'com.squareup.dagger:dagger-compiler:1.2.2' + annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2' + compileOnly 'com.squareup.dagger:dagger-compiler:1.2.2' + implementation 'com.squareup.dagger:dagger:1.2.2' - compile 'com.squareup.dagger:dagger:1.2.2' - compile 'com.birbit:android-priority-jobqueue:1.3.5' + implementation 'com.birbit:android-priority-jobqueue:1.3.5' - testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-all:1.10.19' - testCompile 'org.robolectric:robolectric:2.4' + testImplementation 'junit:junit:4.12' + testImplementation 'org.mockito:mockito-all:1.10.19' + testImplementation 'org.robolectric:robolectric:2.4' } diff --git a/sample/build.gradle b/sample/build.gradle index b1f486ce..b26a4ee9 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -75,36 +75,38 @@ android { } dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - compile 'com.android.support:appcompat-v7:23.4.0' - compile 'com.android.support:support-v13:23.4.0' - compile 'com.android.support:design:23.4.0' - compile 'com.squareup.picasso:picasso:2.5.2' - compile 'com.karumi:dividers:1.0.3' - compile 'com.victor:lib:1.0.1' // https://github.com/yankai-victor/Loading - compile 'com.karumi:marvelapiclient:0.0.4' - compile 'com.github.pedrovgs:renderers:3.0.0' - compile 'com.jakewharton:butterknife:7.0.1' - provided 'com.squareup.dagger:dagger-compiler:1.2.2' - compile project(':rosie') - - androidTestCompile 'com.google.dexmaker:dexmaker:1.2' - androidTestCompile('com.google.dexmaker:dexmaker-mockito:1.2') { + implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation 'com.android.support:appcompat-v7:23.4.0' + implementation 'com.android.support:support-v13:23.4.0' + implementation 'com.android.support:design:23.4.0' + implementation 'com.squareup.picasso:picasso:2.5.2' + implementation 'com.karumi:dividers:1.0.3' + implementation 'com.victor:lib:1.0.1' // https://github.com/yankai-victor/Loading + implementation 'com.karumi:marvelapiclient:0.0.4' + implementation 'com.github.pedrovgs:renderers:3.0.0' + annotationProcessor 'com.jakewharton:butterknife:7.0.1' + implementation 'com.jakewharton:butterknife:7.0.1' + compileOnly 'com.squareup.dagger:dagger-compiler:1.2.2' + annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.2' + implementation project(':rosie') + + androidTestImplementation 'com.google.dexmaker:dexmaker:1.2' + androidTestImplementation('com.google.dexmaker:dexmaker-mockito:1.2') { exclude group: 'org.hamcrest', module: 'hamcrest-core' } - androidTestCompile 'com.android.support.test:runner:0.4.1' - androidTestCompile 'com.android.support.test:rules:0.4.1' - androidTestCompile 'org.mockito:mockito-core:1.10.19' - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.1') { + androidTestImplementation 'com.android.support.test:runner:0.4.1' + androidTestImplementation 'com.android.support.test:rules:0.4.1' + androidTestImplementation 'org.mockito:mockito-core:1.10.19' + androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.1') { exclude group: 'javax.inject', module: 'javax.inject' exclude group: 'com.squareup', module: 'javawriter' } - androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') { + androidTestImplementation('com.android.support.test.espresso:espresso-contrib:2.2.1') { exclude module: 'support-annotations' exclude module: 'recyclerview-v7' exclude module: 'support-v4' } - androidTestCompile('com.android.support.test.espresso:espresso-intents:2.2.1') + androidTestImplementation('com.android.support.test.espresso:espresso-intents:2.2.1') } configurations.all {