hiranpeiris / react-native-otp-auto-fill

Auto fill OTP library for React Native
MIT License
6 stars 8 forks source link

Cant run project using this lib on react native 0.72.5 #18

Open hoangtrunnam opened 8 months ago

hoangtrunnam commented 8 months ago

Execution failed for task ':tasks'.

Could not create task ':react-native-otp-auto-fill:compileDebugJavaWithJavac'. In order to compile Java 9+ source, please set compileSdkVersion to 30 or above

hoangtrunnam commented 8 months ago

this bug happened when your react native project required compileSdkVersion >= 30. you can see this lib uses compileSdkVersion = 29 (node_modules/react-native-otp-auto-fill/android/build.gradle).

=>>> Update your build.gradle file in your root project: android/buildgradle (not in node_moudles) like this:

buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 OtpAutoFill_compileSdkVersion = 33 // have to change this to 33 to run on react native 0.72.5

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}
repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath 'com.google.gms:google-services:4.4.0'
    classpath("com.android.tools.build:gradle")
    classpath("com.facebook.react:react-native-gradle-plugin")
}

}

tanmoy-cloudly commented 7 months ago

this bug happened when your react native project required compileSdkVersion >= 30. you can see this lib uses compileSdkVersion = 29 (node_modules/react-native-otp-auto-fill/android/build.gradle).

=>>> Update your build.gradle file in your root project: android/buildgradle (not in node_moudles) like this:

buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 OtpAutoFill_compileSdkVersion = 33 // have to change this to 33 to run on react native 0.72.5

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}
repositories {
    google()
    mavenCentral()
}
dependencies {
    classpath 'com.google.gms:google-services:4.4.0'
    classpath("com.android.tools.build:gradle")
    classpath("com.facebook.react:react-native-gradle-plugin")
}

}

Thank you so much. It solved my issue on RN 0.72.6