2

I was opening this webview project and met an error immediatly on importing the project.

No variants found for 'app'. Check build files to ensure at least one variant exists.

Already tried this and it didn't help. I am new to android, someone please help.

The following is the build.gradle file

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

buildscript {
    ext.kotlin_version = '1.3.41'
    ext.kotlin_version = '1.3.21'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.3.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 {
    repositories {
        google()
        jcenter()
    }
}

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

Here is the full project https://github.com/mgks/Kotlin-SmartWebView

enter image description here

Shijil
  • 25
  • 1
  • 1
  • 6

1 Answers1

1

As explained in this other answer what you want to look at is the app-level build.gradle file (what you have here is the top-level build.gradle file). Get the compileSdkVersion and use the SDK Manager to download the corresponding Android SDK Version.

Example build.gradle file


android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
    applicationId "com.app-10.app"
    minSdkVersion 23
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

In the above example, the compileSdkVersion is 29, so the Android SDK version to download (using the SDK Manager) would be API level 29.

Tobi Daada
  • 528
  • 2
  • 8