Fashad Ahmed
Fashad Ahmed

Reputation: 171

Could not create task ':react-native-alarm-manager:compileDebugJavaWithJavac'

I have installed this package https://www.npmjs.com/package/react-native-alarm-manager and now upon running the android application it gives me this error **

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

The specified Android SDK Build Tools version (29.0.3) is ignored, as it is below the minimum supported version (30.0.3) for Android Gradle Plugin 7.4.2. Android SDK Build Tools 30.0.3 will be used. To suppress this warning, remove "buildToolsVersion '29.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools. In order to compile Java 9+ source, please set compileSdkVersion to 30 or above

**

I am using v0.72.4 of React native

Upvotes: 0

Views: 279

Answers (2)

Deepak
Deepak

Reputation: 436

As mentioned in the error this package needs compileSdkVersion to be 30+. As you are already on 0.72.x react-native you can do following changes:

in project level build.gradle inside ext change compileSdkVersion and targetSdkVersion to 33 clean gradle and run you app. It should work

buildscript {
    ext {
        //...other changes
        compileSdkVersion = 33
        targetSdkVersion = 33
    }

Upvotes: 1

tomerpacific
tomerpacific

Reputation: 6510

Inside of your React Native project, you have an android directory. Inside of it, there could be several places where the targetSdkVersion and compileSdkVersion will be defined. One option is the build.gradle file:

android {
  compileSdkVersion 
  ....

Another option could be the gradle.properties file

Just make sure to update the values to be 30 (or above).

Upvotes: 1

Related Questions