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 5 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'
api fileTree(dir: 'libs', include: ['*.jar'])
api 'com.android.support:appcompat-v7:27.0.2'
Copy link
Contributor

@hramos hramos Feb 14, 2018

Choose a reason for hiding this comment

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

👍 We're using 27.0.2 internally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good to know.


// Build React Native from source
compile project(':ReactAndroid')
api project(':ReactAndroid')
}
2 changes: 1 addition & 1 deletion RNTester/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

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

<!--
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
7 changes: 3 additions & 4 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,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 @@ -292,7 +291,7 @@ 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'
api 'com.android.support:appcompat-v7:27.0.2'
compile 'com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.0.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

replace compile with implementation

compile 'com.facebook.fresco:fresco:1.9.0'
compile 'com.facebook.fresco:imagepipeline-okhttp3:1.9.0'
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package="com.facebook.react.tests.gradle"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:targetSdkVersion="7" />
<uses-sdk android:targetSdkVersion="27" />
Copy link
Contributor

Choose a reason for hiding this comment

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

This is useless.

Choose a reason for hiding this comment

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

should be completely removed. Also libraries should not even define targetSdk

<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
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ buildscript {
repositories {
jcenter()
mavenLocal()
google()
}
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 All @@ -23,5 +24,6 @@ allprojects {
maven {
url "$androidSdk/extras/m2repository/"
}
google()
}
}
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.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.+"
api fileTree(dir: "libs", include: ["*.jar"])
api "com.android.support:appcompat-v7:27.0.2"
api "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')) {
api project(':test')
api(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.+"
api fileTree(dir: "libs", include: ["*.jar"])
api "com.android.support:appcompat-v7:27.0.2"
api "com.facebook.react:react-native:0.18.+"
}
4 changes: 2 additions & 2 deletions local-cli/link/android/patches/makeBuildPatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const normalizeProjectName = require('./normalizeProjectName');
module.exports = function makeBuildPatch(name) {
const normalizedProjectName = normalizeProjectName(name);
const installPattern = new RegExp(
`\\s{4}(compile)(\\(|\\s)(project)\\(\\\':${normalizedProjectName}\\\'\\)(\\)|\\s)`
`\\s{4}(api)(\\(|\\s)(project)\\(\\\':${normalizedProjectName}\\\'\\)(\\)|\\s)`
);

return {
installPattern,
pattern: /[^ \t]dependencies {\n/,
patch: ` compile project(':${normalizedProjectName}')\n`
patch: ` api project(':${normalizedProjectName}')\n`
};
};
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
api fileTree(dir: "libs", include: ["*.jar"])
api "com.android.support:appcompat-v7:27.0.2"
api "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.1-all.zip
6 changes: 3 additions & 3 deletions scripts/circle-ci-android-setup.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# inspired by https://github.com/Originate/guide/blob/master/android/guide/Continuous%20Integration.md

# SDK Built Tools revision, per http://facebook.github.io/react-native/docs/getting-started.html
ANDROID_SDK_BUILD_TOOLS_REVISION=23.0.1
# SDK Build Tools revision, per http://facebook.github.io/react-native/docs/getting-started.html
ANDROID_SDK_BUILD_TOOLS_REVISION=27.0.3
# API Level we build with
ANDROID_SDK_BUILD_API_LEVEL="23"
ANDROID_SDK_BUILD_API_LEVEL="27"
# Minimum API Level we target, used for emulator image
ANDROID_SDK_TARGET_API_LEVEL="19"
# Emulator name
Expand Down