From 5c7b941ac53f0813630860f663ba8e8e22b8cc88 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 22 Aug 2018 23:12:41 -0700 Subject: [PATCH] bump android gradle to 3.1.4 (#20767) Summary: Bump android gradle plugin to 3.1.4. We have been stay to 2.x too long. With 3.x we can have instant run and great performance and new features brought by google. Also thanks to CFKevinRef great pr to make this possible. pass all current ci. I have also tested RNTester release version works without crash. https://github.com/facebook/react-native/pull/17967. [GENERAL] [ANDROID] [FEATURE] - bump android gradle to 3.1.4 Pull Request resolved: https://github.com/facebook/react-native/pull/20767 Differential Revision: D9437576 Pulled By: hramos fbshipit-source-id: 6084056a1390582a75a879918f2538b0480f6299 --- RNTester/android/app/build.gradle | 6 +-- ReactAndroid/build.gradle | 42 +++++++++---------- build.gradle | 12 ++---- .../HelloWorld/android/app/build.gradle | 6 +-- .../templates/HelloWorld/android/build.gradle | 12 ++---- 5 files changed, 33 insertions(+), 45 deletions(-) diff --git a/RNTester/android/app/build.gradle b/RNTester/android/app/build.gradle index 3cacfe0409cb94..bc2423dd6fa257 100644 --- a/RNTester/android/app/build.gradle +++ b/RNTester/android/app/build.gradle @@ -140,9 +140,9 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:27.1.1' + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:27.1.1' // Build React Native from source - compile project(':ReactAndroid') + implementation project(':ReactAndroid') } diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 54a139e71fa6a4..7c88ab3019456d 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -293,29 +293,29 @@ android { } dependencies { - compile 'com.facebook.infer.annotation:infer-annotation:0.11.2' - compile 'javax.inject:javax.inject:1' - compile 'com.android.support:appcompat-v7:27.1.1' - compile "com.facebook.fresco:fresco:${FRESCO_VERSION}" - compile "com.facebook.fresco:imagepipeline-okhttp3:${FRESCO_VERSION}" - compile 'com.facebook.soloader:soloader:0.5.1' - compile 'com.google.code.findbugs:jsr305:3.0.2' - compile "com.squareup.okhttp3:okhttp:${OKHTTP_VERSION}" - compile "com.squareup.okhttp3:okhttp-urlconnection:${OKHTTP_VERSION}" - compile 'com.squareup.okio:okio:1.14.0' + api 'com.facebook.infer.annotation:infer-annotation:0.11.2' + api 'javax.inject:javax.inject:1' + api 'com.android.support:appcompat-v7:27.1.1' + api "com.facebook.fresco:fresco:${FRESCO_VERSION}" + api "com.facebook.fresco:imagepipeline-okhttp3:${FRESCO_VERSION}" + api 'com.facebook.soloader:soloader:0.5.1' + api 'com.google.code.findbugs:jsr305:3.0.2' + api "com.squareup.okhttp3:okhttp:${OKHTTP_VERSION}" + api "com.squareup.okhttp3:okhttp-urlconnection:${OKHTTP_VERSION}" + api 'com.squareup.okio:okio:1.14.0' compile 'org.webkit:android-jsc:r174650' - testCompile "junit:junit:${JUNIT_VERSION}" - testCompile "org.powermock:powermock-api-mockito:${POWERMOCK_VERSION}" - testCompile "org.powermock:powermock-module-junit4-rule:${POWERMOCK_VERSION}" - testCompile "org.powermock:powermock-classloading-xstream:${POWERMOCK_VERSION}" - testCompile "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}" - testCompile "org.easytesting:fest-assert-core:${FEST_ASSERT_CORE_VERSION}" - testCompile "org.robolectric:robolectric:${ROBOLECTRIC_VERSION}" - - androidTestCompile fileTree(dir: 'src/main/third-party/java/buck-android-support/', include: ['*.jar']) - androidTestCompile 'com.android.support.test:runner:0.3' - androidTestCompile "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}" + testImplementation "junit:junit:${JUNIT_VERSION}" + testImplementation "org.powermock:powermock-api-mockito:${POWERMOCK_VERSION}" + testImplementation "org.powermock:powermock-module-junit4-rule:${POWERMOCK_VERSION}" + testImplementation "org.powermock:powermock-classloading-xstream:${POWERMOCK_VERSION}" + testImplementation "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}" + testImplementation "org.easytesting:fest-assert-core:${FEST_ASSERT_CORE_VERSION}" + testImplementation "org.robolectric:robolectric:${ROBOLECTRIC_VERSION}" + + androidTestImplementation fileTree(dir: 'src/main/third-party/java/buck-android-support/', include: ['*.jar']) + androidTestImplementation 'com.android.support.test:runner:0.3' + androidTestImplementation "org.mockito:mockito-core:${MOCKITO_CORE_VERSION}" } apply from: 'release.gradle' diff --git a/build.gradle b/build.gradle index 6128d679600d28..582fa465717225 100644 --- a/build.gradle +++ b/build.gradle @@ -7,13 +7,10 @@ buildscript { repositories { jcenter() mavenLocal() - maven { - url 'https://maven.google.com/' - name 'Google' - } + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:3.1.4' classpath 'de.undercouch:gradle-download-task:3.4.3' // NOTE: Do not place your application dependencies here; they belong @@ -25,10 +22,7 @@ allprojects { repositories { jcenter() mavenLocal() - maven { - url 'https://maven.google.com/' - name 'Google' - } + google() def androidSdk = System.getenv("ANDROID_SDK") maven { diff --git a/local-cli/templates/HelloWorld/android/app/build.gradle b/local-cli/templates/HelloWorld/android/app/build.gradle index 31a0da9a576ea7..793eae821101a8 100644 --- a/local-cli/templates/HelloWorld/android/app/build.gradle +++ b/local-cli/templates/HelloWorld/android/app/build.gradle @@ -137,9 +137,9 @@ android { } dependencies { - compile fileTree(dir: "libs", include: ["*.jar"]) - compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" - compile "com.facebook.react:react-native:+" // From node_modules + implementation fileTree(dir: "libs", include: ["*.jar"]) + implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" + implementation "com.facebook.react:react-native:+" // From node_modules } // Run this once to be able to run the application with BUCK diff --git a/local-cli/templates/HelloWorld/android/build.gradle b/local-cli/templates/HelloWorld/android/build.gradle index 8638267d1be79c..0c58813ffc864e 100644 --- a/local-cli/templates/HelloWorld/android/build.gradle +++ b/local-cli/templates/HelloWorld/android/build.gradle @@ -3,13 +3,10 @@ buildscript { repositories { jcenter() - maven { - url 'https://maven.google.com/' - name 'Google' - } + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:3.1.4' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -24,10 +21,7 @@ allprojects { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$rootDir/../node_modules/react-native/android" } - maven { - url 'https://maven.google.com/' - name 'Google' - } + google() } }