Gradle: Could not create an instance of type com.a

2019-07-22 20:29发布

问题:

I have an issue with Gradle running on Jenkins:

A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.android.application']
   > Could not create an instance of type com.android.build.gradle.internal.dsl.SigningConfig_Decorated.

Top level build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

Line the error occurrs on (file app/build.gradle):

apply plugin: 'com.android.application'

I tried using Gradle wrapper/Invoke Gradle, and with different versions down to 2.10. I'm using "Force GRADLE_USER_HOME to use workspace".

回答1:

Encountered the same issue after updating to Gradle 2.10. I had to create a folder named /usr/share/tomcat/.android and give it all permissions (chmod a+rwx .android). That fixed the issue for me.



回答2:

You are probably missing the Android SDK build tools. If you open the gradle.build file using Android Studio it can help you install the required tools. Or have a look at How to install Android SDK Build Tools on the command line?