Ionic 5 app build error: "compileSdkVersion is not specified. Please add it to build.gradle"

Viewed 98

When I run ionic cordova run android to build my ionic5 app, get below error:

2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle

My build.gradle file is:

// Top-level build file where you can add configuration options common to all sub- projects/modules.

buildscript {
ext.kotlin_version = '1.3.50'
apply from: 'repositories.gradle'
repositories repos

dependencies {
    classpath 'com.android.tools.build:gradle:4.0.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
apply from: 'repositories.gradle'
repositories repos

//This replaces project.properties w.r.t. build settings
project.ext {
  defaultBuildToolsVersion="29.0.2" //String
  defaultMinSdkVersion=22 //Integer - Minimum requirement is Android 5.1
  defaultTargetSdkVersion=29 //Integer - We ALWAYS target the latest by default
  defaultCompileSdkVersion=29 //Integer - We ALWAYS compile with the latest by default
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

Can you please tell how to add the compileSdkVersion into build .gradle?

0 Answers
Related