Skip to content

RN 0.82.1 compile problem #22

@xaiamov

Description

@xaiamov

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-usb-serialport@3.0.0 for the project I'm working on.

I couldn't compile the module on a fresh RN app install.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':react-native-usb-serialport:bundleLibCompileToJarDebug'.
> Could not create task ':react-native-usb-serialport:compileDebugJavaWithJavac'.
   > In order to compile Java 9+ source, please set compileSdkVersion to 30 or above

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-usb-serialport/android/build.gradle b/node_modules/react-native-usb-serialport/android/build.gradle
index 6d6aa50..14876b1 100644
--- a/node_modules/react-native-usb-serialport/android/build.gradle
+++ b/node_modules/react-native-usb-serialport/android/build.gradle
@@ -13,8 +13,7 @@ buildscript {
 apply plugin: 'com.android.library'
 
 android {
-    compileSdkVersion 28
-    buildToolsVersion "28.0.3"
+    compileSdkVersion 31
 
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_8
@@ -23,7 +22,7 @@ android {
 
     defaultConfig {
         minSdkVersion 16
-        targetSdkVersion 28
+        targetSdkVersion 31
         versionCode 1
         versionName "1.0"
     }

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions