Skip to content

Commit 38eb2a7

Browse files
dulmandakhfacebook-github-bot
authored andcommittedFeb 5, 2019
Enable Java8 (#23295)
Summary: Running *lint* on RN found that there are some Java 8 features used without specifying Java 8 compatibility in projects. This PR adds Java 8 compatibility and fixes errors caused by Java 8 feature use. I suspend that it may be cause of many failures on older Androids, but also found that many modules/packages switched to and require Java 8. ```java ../../src/main/java/com/facebook/react/devsupport/BundleDownloader.java:167: Try-with-resources requires API level 19 (current min is 16) ../../src/main/java/com/facebook/react/devsupport/DevServerHelper.java:658: Try-with-resources requires API level 19 (current min is 16) ``` For more information https://developer.android.com/studio/write/java8-support [Android] [Changed] - Enable Java 8 Pull Request resolved: #23295 Differential Revision: D13959096 Pulled By: cpojer fbshipit-source-id: 0bfd0565b61a132906cf35ee55b4afcf5450f7cb
1 parent 8beb4bb commit 38eb2a7

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed
 

‎RNTester/android/app/build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ def enableProguardInReleaseBuilds = true
9393
android {
9494
compileSdkVersion 28
9595

96+
compileOptions {
97+
sourceCompatibility JavaVersion.VERSION_1_8
98+
targetCompatibility JavaVersion.VERSION_1_8
99+
}
100+
96101
defaultConfig {
97102
applicationId "com.facebook.react.uiapp"
98103
minSdkVersion 16

‎ReactAndroid/build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ task packageReactNdkLibsForBuck(dependsOn: packageReactNdkLibs, type: Copy) {
266266
android {
267267
compileSdkVersion 28
268268

269+
compileOptions {
270+
sourceCompatibility JavaVersion.VERSION_1_8
271+
targetCompatibility JavaVersion.VERSION_1_8
272+
}
273+
269274
defaultConfig {
270275
minSdkVersion 16
271276
targetSdkVersion 27

‎template/android/app/build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def enableProguardInReleaseBuilds = false
9696
android {
9797
compileSdkVersion rootProject.ext.compileSdkVersion
9898

99+
compileOptions {
100+
sourceCompatibility JavaVersion.VERSION_1_8
101+
targetCompatibility JavaVersion.VERSION_1_8
102+
}
103+
99104
defaultConfig {
100105
applicationId "com.helloworld"
101106
minSdkVersion rootProject.ext.minSdkVersion

0 commit comments

Comments
 (0)