Plugin with id 'com.android.application' not found in Github Winlator Project

45 views Asked by At

I try to setup the android app Winlator (https://github.com/brunodev85/winlator) on Android Studio, but I always get the error "A problem occurred evaluating root project 'app'. Plugin with id 'com.android.application' not found." from the build.grade (app) file.

How I can I fix it?

apply plugin: 'com.android.application'

android {
    compileSdk 30
    buildToolsVersion '30.0.3'

    defaultConfig {
        applicationId 'com.winlator'
        minSdkVersion 26
        targetSdkVersion 28
        versionCode 12
        versionName "6.0"
    }

    buildTypes {
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

            ndk {
                abiFilters 'arm64-v8a', 'armeabi-v7a'
            }
        }
    }

    lintOptions {
        checkReleaseBuilds false
    }

    externalNativeBuild {
        cmake {
            version '3.22.1'
            path 'src/main/cpp/CMakeLists.txt'
        }
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.preference:preference:1.1.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'com.github.luben:zstd-jni:1.5.2-3@aar'
    implementation 'org.tukaani:xz:1.7'
    implementation 'org.apache.commons:commons-compress:1.20'
}

I tried different project setting and always failed.

1

There are 1 answers

0
Martin Zeitler On

This project only has one single module-level build.gradle, while the root-project build.gradle, which loads the plugins onto the class-path, is absent. Just take such one from another project and drop it into the directory above - or configure the repositories in a settings.gradle, for example:

import org.gradle.api.initialization.resolve.RepositoriesMode

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.name = "SomeApp"

include ':app'

In particular, without the instruction include ':app', Android Studio will ignore the module altogether. Beside that, you still need to add a root-level build.gradle, with a plugins block.

This would load the current AGP 8.3.1 onto the plugin class-path (in the added build.gradle):

plugins {
    id "com.android.application" version "8.3.1" apply false
}

This subsequently requires the current version of Android Studio (needs to match).

Further reading: Android Gradle Plugin: Configure your build