Gradle: Could not create plugin of type AppPlugin

16,759

Solution 1

Ooops, appearently I was using the wrong version of Gradle. My bad!

This 2 lines could make it clear what version is used

println GradleVersion.current().prettyPrint()
assert gradle.gradleVersion >= "1.10" // android plugin 0.10 requires Gradle 1.10, 1.11, 1.12

Solution 2

In my case, run cmd.exe as Administrator and input gradle command in the cmd console, the error is gone.

Share:
16,759
Black Magic
Author by

Black Magic

Software Engineer at Vitas. Developing Cyber Security Related Software

Updated on July 19, 2022

Comments

  • Black Magic
    Black Magic almost 2 years

    I can't seem to build my Android app with Gradle.

    build.gradle:

    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:0.6.+'
        }
    }
    
    apply plugin: 'android'
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        compile 'com.intellij:annotations:12.0'
    }
    
    android {
        compileSdkVersion 19
        buildToolsVersion "19"
    
        defaultConfig {
            minSdkVersion 14
            targetSdkVersion 19
            versionCode = 82
            versionName = "0.6.1"
        }
    
        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = ['src']
                resources.srcDirs = ['src']
                aidl.srcDirs = ['src']
                renderscript.srcDirs = ['src']
                res.srcDirs = ['res']
                assets.srcDirs = ['assets']
            }
    
            xposedmodule {
                manifest.srcFile 'xposed/AndroidManifest.xml'
                java.srcDirs = ['xposed/src']
                resources.srcDirs = ['xposed/src']
                aidl.srcDirs = ['xposed/src']
                renderscript.srcDirs = ['xposed/src']
                res.srcDirs = ['xposed/res']
                assets.srcDirs = ['xposed/assets']
            }
    
        }
    
        /*
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }*/
    
        signingConfigs {
            release
        }
    
        buildTypes {
            release {
                signingConfig signingConfigs.release
            }
        }
    }
    
    // ~/.gradle/gradle.properties
    if (project.hasProperty('keystoreFile') &&
            project.hasProperty('keystorePassword') &&
            project.hasProperty('keystoreAliasPassword')) {
        android.signingConfigs.release.storeFile = file(keystoreFile)
        android.signingConfigs.release.storePassword = keystorePassword
        android.signingConfigs.release.keyPassword = keystoreAliasPassword
        android.signingConfigs.release.keyAlias = keystoreAlias
    } else {
        android.buildTypes.release.signingConfig = null
    }
    
    //http://stackoverflow.com/questions/16683775/include-so-library-in-apk-in-android-studio
    tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
        pkgTask.jniDir new File(buildDir, 'native-libs')
    }
    

    I use Gradle 1.10 and I get the following error when issuing this command:

    gradle build.gradle --refresh-dependencies
    

    Error:

    Could not create plugin of type 'AppPlugin'
    
  • Justin C
    Justin C over 10 years
    so what was the right version of Gradle and were their any steps specific to your project to use unsaid version?
  • Black Magic
    Black Magic over 10 years
    The correct version was 1.6, and I dont think there were.