0

I've been trying to fix this error but i can't seem to get it to build.. the emulator works and all that but i cant seem to get the program to build properly

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31
        kotlin_version = '1.6.10'
        ndkVersion = "22.0.7026061"
    }
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.1.0")
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.14'
    }
}

def REACT_NATIVE_VERSION = new File(['node', '--print', "JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim())

allprojects {
    configurations.all {
        resolutionStrategy {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
        }
    }

    repositories {
        mavenLocal()
        maven {
            url(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../android"))
        }
        maven {
            url(new File(["node", "--print", "require.resolve('jsc-android/package.json')"].execute(null, rootDir).text.trim(), "../dist"))
        }

        google()
        mavenCentral()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

this is the error i get when i try to run it

Cause: compileSdkVersion is not specified. Please add it to build.gradle

Im a newbie to gradle so much help would be appreciated, thank you!

  • As per error , it looks like compileSdkVersion is not mentioned in app module build.gradle file .. Can you add build.gradle file of ```Module``` level – jayesh gurudayalani Mar 31 '23 at 06:08
  • https://stackoverflow.com/questions/50530889/gradle-sync-failed-cause-compilesdkversion-is-not-specified Please check solution in here – Hoa.Tran Mar 31 '23 at 06:27
  • @jayeshgurudayalani it turns out it was because nullish coalescing assignment operator wasn't compatible yet with my project – julcodecode Apr 08 '23 at 06:58

0 Answers0