John
John

Reputation: 1407

Android studio updation build error

I have updated the android studio to latest version : android studio 2.2 preview 1

it supports JDK 1.8(java 8)

after updating the studio getting following build error

Cause: com.android.build.gradle.AppPlugin cannot be cast to groovy.lang.GroovyObject

Error:Cause: com.android.build.gradle.AppPlugin cannot be cast to groovy.lang.GroovyObject

Possible causes for this unexpected error include:

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

Tried all the following ways :

  1. tried This link
  2. Tried This link as well

Please help to solve this problem

Will be adding my build.gradle file

buildscript {

repositories {
    maven { url 'https://maven.fabric.io/public' }
    flatDir { dirs '/usr/local/DexGuard-7.0.22/lib' }
    mavenCentral()                  // For the Android plugin.
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
    classpath ':dexguard:'
}}`apply plugin: 'com.android.application'


apply plugin: 'dexguard'
apply plugin: 'io.fabric'

afterEvaluate { project ->
  tasks['dexguardRelease'].enabled = true
 }repositories {
     maven { url 'https://maven.fabric.io/public' }
}android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
    applicationId 'com.package.name'
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0.1"
    useLibrary 'org.apache.http.legacy'
}
productFlavors {
}

buildTypes {
    debug {
        minifyEnabled false
        proguardFile getDefaultDexGuardFile('dexguard-debug.pro')
        proguardFile 'dexguard-project.txt'
        //proguardFile 'proguard-project.txt'
    }
    release {
        minifyEnabled true
        proguardFile getDefaultDexGuardFile('dexguard-release.pro')
        proguardFile 'dexguard-project.txt'
        //proguardFile 'proguard-project.txt'
    }}}dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
    transitive = true;
}
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.google.android.gms:play-services-location:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'com.google.android.gms:play-services-maps:9.9.0'
compile 'com.google.android.gms:play-services-analytics:9.0.0'}apply plugin: 'com.google.gms.google-services'`

Top level gradle

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.0-alpha1'
    classpath 'com.google.gms:google-services:3.0.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}}allprojects {
repositories {
    jcenter()
}}task clean(type: Delete) {
delete rootProject.buildDir}

Upvotes: 2

Views: 1786

Answers (2)

Bret
Bret

Reputation: 31

I had the same issue with one of my projects. I dropped the gradle version back a minor version and it resolved the issue for me.

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

Upvotes: 1

Arunjyothis
Arunjyothis

Reputation: 1446

Try removing dexguard & its related entries, Keep minifyEnabled as false & remove related entries, i.e.proguardFile getDefaultDexGuardFile('dexguard-release.pro')

Upvotes: 0

Related Questions