Skip to content

Commit

Permalink
Enable Java8 (#23295)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dulmandakh authored and facebook-github-bot committed Feb 5, 2019
1 parent 8beb4bb commit 38eb2a7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions RNTester/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ def enableProguardInReleaseBuilds = true
android {
compileSdkVersion 28

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId "com.facebook.react.uiapp"
minSdkVersion 16
Expand Down
5 changes: 5 additions & 0 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,11 @@ task packageReactNdkLibsForBuck(dependsOn: packageReactNdkLibs, type: Copy) {
android {
compileSdkVersion 28

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
minSdkVersion 16
targetSdkVersion 27
Expand Down
5 changes: 5 additions & 0 deletions template/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId "com.helloworld"
minSdkVersion rootProject.ext.minSdkVersion
Expand Down

0 comments on commit 38eb2a7

Please sign in to comment.