Android Studio -- Failed to apply plugin [id 'appengine']

Viewed 239

When I sync my project with Gradle files, I get the following errors:

Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'appengine']

and

Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'classesDir' for functional test classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.

My gradle is on the latest version and I've tried previous solutions on Stack Overflow, but none of them seem to work.

Project Build.Gradle:


buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:3.6.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }


}

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

Backend build.gradle:

// https://github.com/GoogleCloudPlatform/gradle-appengine-plugin

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.google.appengine:gradle-appengine-plugin:1.9.59'
    }
}

repositories {
    jcenter();
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

dependencies {
  appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.59'
  compile 'com.google.appengine:appengine-endpoints:1.9.18'
  compile 'com.google.appengine:appengine-endpoints-deps:1.9.18'
  compile 'javax.servlet:servlet-api:2.5'
}

appengine {
  downloadSdk = true
  appcfg {
    oauth2 = true
  }
  endpoints {
    getClientLibsOnBuild = true
    getDiscoveryDocsOnBuild = true
  }
}

It seems as the main issue is the App Engine plugin, but I'm not sure how to fix that. I believe the latest gradle files are being used, which was a solution other stack overflow solutions provided, but didn't work for me. If anyone has insight on this, it'd be great.

1 Answers

'classesDir' is deprecated and removed in gradle 5.X onwards try replacing it by 'classesDirs'. Check this out for information here.

Related