Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Gradle and Android SDK versions. #17747

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions RNTester/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,12 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 27

defaultConfig {
applicationId "com.facebook.react.uiapp"
minSdkVersion 16
targetSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
ndk {
Expand Down Expand Up @@ -136,9 +135,9 @@ android {
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.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')
}
3 changes: 1 addition & 2 deletions RNTester/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
<uses-permission android:name="android.permission.READ_CALENDAR"/>

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="23" />
android:minSdkVersion="16" />

<!--
android:icon is used to display launcher icon on mobile devices.
Expand Down
6 changes: 3 additions & 3 deletions ReactAndroid/DevExperience.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Assuming you have the [Android SDK](https://developer.android.com/sdk/installing

Make sure you have the following installed:

- Android SDK version 23
- SDK build tools version 23
- Android Support Repository 17 (for Android Support Library)
- Android SDK version 27
- SDK build tools version 27
- Android Support Repository 47 (for Android Support Library)

Follow steps on https://github.com/facebook/react-native/blob/master/react-native-cli/CONTRIBUTING.md, but be sure to bump the version of react-native in package.json to some version > 0.9 (latest published npm version) or set up proxying properly for react-native

Expand Down
29 changes: 14 additions & 15 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,11 @@ task packageReactNdkLibsForBuck(dependsOn: packageReactNdkLibs, type: Copy) {
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we rely on buildToolsVersion in the CI. That's why test_android is failing.

MAJOR=`echo $BUILD_TOOLS_VERSION | sed 's/\..*//'`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new gradle version will choose the build tools version itself, but specifying it here won't (afaik) hurt either.

compileSdkVersion 27

defaultConfig {
minSdkVersion 16
targetSdkVersion 22
targetSdkVersion 27
versionCode 1
versionName "1.0"

Expand Down Expand Up @@ -293,18 +292,18 @@ android {
}

dependencies {
compile fileTree(dir: 'src/main/third-party/java/infer-annotations/', include: ['*.jar'])
compile 'javax.inject:javax.inject:1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.0.0'
compile 'com.facebook.fresco:fresco:1.9.0'
compile 'com.facebook.fresco:imagepipeline-okhttp3:1.9.0'
compile 'com.facebook.soloader:soloader:0.3.0'
compile 'com.google.code.findbugs:jsr305:3.0.0'
compile 'com.squareup.okhttp3:okhttp:3.10.0'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
compile 'com.squareup.okio:okio:1.14.0'
compile 'org.webkit:android-jsc:r174650'
implementation fileTree(dir: 'src/main/third-party/java/infer-annotations/', include: ['*.jar'])
implementation 'javax.inject:javax.inject:1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.0.0'
implementation 'com.facebook.fresco:fresco:1.9.0'
implementation 'com.facebook.fresco:imagepipeline-okhttp3:1.9.0'
implementation 'com.facebook.soloader:soloader:0.3.0'
implementation 'com.google.code.findbugs:jsr305:3.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
implementation 'com.squareup.okio:okio:1.14.0'
implementation 'org.webkit:android-jsc:r174650'

testCompile "junit:junit:${JUNIT_VERSION}"
testCompile "org.powermock:powermock-api-mockito:${POWERMOCK_VERSION}"
Expand Down
1 change: 0 additions & 1 deletion ReactAndroid/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package="com.facebook.react.tests.gradle"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:targetSdkVersion="7" />
<supports-screens android:anyDensity="true" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'de.undercouch:gradle-download-task:3.1.2'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'de.undercouch:gradle-download-task:3.3.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
6 changes: 3 additions & 3 deletions local-cli/link/__fixtures__/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.18.+"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.facebook.react:react-native:0.18.+"
}
10 changes: 5 additions & 5 deletions local-cli/link/__fixtures__/android/patchedBuild.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dependencies {
compile project(':test')
compile(project(':test2')) {
implementation project(':test')
implementation(project(':test2')) {
exclude(group: 'org.unwanted', module: 'test10')
}
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.18.+"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.facebook.react:react-native:0.18.+"
}
11 changes: 5 additions & 6 deletions local-cli/templates/HelloWorld/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,12 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 27

defaultConfig {
applicationId "com.helloworld"
minSdkVersion 16
targetSdkVersion 22
targetSdkVersion 27
versionCode 1
versionName "1.0"
ndk {
Expand Down Expand Up @@ -137,9 +136,9 @@ android {
}

dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.facebook.react:react-native:+" // From node_modules
}

// Run this once to be able to run the application with BUCK
Expand Down
4 changes: 3 additions & 1 deletion local-cli/templates/HelloWorld/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -20,5 +21,6 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
google()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself or whoever imports this to FB: If this PR is approved, please see D8459570 for an example of how to update the offline Gradle cache as part of the import process. This will needed in order to land this PR without breaking the internal React Native OSS Android test.