简体   繁体   中英

Android gradle build Error:(65, 0) Gradle DSL method not found: 'compile()'

I am getting the following build error when I try and sync my project:

Error:(65, 0) Gradle DSL method not found: 'compile()' Possible causes: The project 'arcane_rider' may be using a version of the Android Gradle plug-in that does not contain the method (eg 'testCompile' was added in 1.1.0). Upgrade plugin to version 2.3.3 and sync project The project 'arcane_rider' may be using a version of Gradle that does not contain the method. Open Gradle wrapper file The build file may be missing a Gradle plugin. Apply Gradle plugin

Gradle Console Log

Executing tasks: [clean, :app:generateDebugSources, :app:compileDebugSources]

Configuration on demand is an incubating feature. NDK is missing a "platforms" directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\\Users\\khanad1\\AppData\\Local\\Android\\Sdk\\ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.

FAILURE: Build failed with an exception.

  • Where: Build file 'C:\\Users\\khanad1\\Desktop\\Someapp\\app\\build.gradle' line: 65

  • What went wrong: A problem occurred evaluating project ':app'.

    Could not find method compile() for arguments [org.androidannotations:androidannotations-api:4.2.0] on DefaultExternalModuleDependency{group='org.androidannotations', name='androidannotations', version='4.2.0', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

I have tried applying every single gradle plugin they link me to in that link on the bottom, still same issue.

Project build.gradle

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        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
}

App build.gradle

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'com.neenbedankt.android-apt'
def AAVersion = '4.2.0'

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        mavenLocal()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.1'

    defaultConfig {
        applicationId "com.cog.arcaneRider"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 4
        versionName "3.1"
        // Enabling multidex support.
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'
}

apt {
    arguments {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    //Default
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:support-annotations:23.4.0'
    compile 'com.android.support:design:25.3.1'
    compile 'com.google.android.gms:play-services:11.0.4'
    //Multidex
    compile 'com.android.support:multidex:1.0.0'
    //Card View
    compile 'com.android.support:cardview-v7:25.3.1'
    //Annotation
    apt "org.androidannotations:androidannotations:$AAVersion" compile "org.androidannotations:androidannotations-api:$AAVersion"
    //Validator
    compile 'com.mobsandgeeks:android-saripaar:2.0.2'
    //EditText
    compile 'com.rengwuxian.materialedittext:library:2.1.4'
    //Facebook SDK
    compile 'com.facebook.android:facebook-android-sdk:4.0.0'
    //Firebase & GeoFire
    compile 'com.google.firebase:firebase-core:10.0.1'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.firebase:geofire-android:2.0.0'
    //glide
    compile 'com.github.bumptech.glide:glide:3.7.0'
    //location update
    compile 'com.akhgupta:android-easylocation:1.0.1'
    //Route Drawer
    compile 'com.akexorcist:googledirectionlibrary:1.0.5'
    //Top Snackbar
    compile 'com.androidadvance:topsnackbar:1.1.1'
    //Universal Image Loader
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    //Stripe
    compile('com.stripe:stripe-android:1.0.4@aar') {
        transitive = true;
    }
    //Fabric
    compile('io.fabric.sdk.android:fabric:1.3.10@aar') {
        transitive = true;
    }
    //Crashlytics
    compile('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
        transitive = true;
    }
    //Volley
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.squareup.okhttp3:okhttp:3.6.0'
}

apply plugin: 'com.google.gms.google-services'
//TestFairy start - autogenerated by TestFairy intellij plugin
//manual changes might get overwritten
buildscript {
   repositories {
       mavenCentral()
       maven { url 'https://www.testfairy.com/maven' }
   }
   dependencies {
       classpath 'com.testfairy.plugins.gradle:testfairy:1.+'
   }
}
apply plugin: 'testfairy'
android {
   testfairyConfig {
       apiKey '574a933e0d5c547fe3e9183e86ff9e13bf53ed74'
   }
}
//TestFairy end

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

Went thru all of the stack overflow answers but can't figure it out what I am doing wrong here. Any help will be highly appreciated. Thank you

Could not find method compile() for arguments [org.androidannotations:androidannotations-api:4.2.0] on

Move in two different lines this:

//Annotation
apt "org.androidannotations:androidannotations:$AAVersion" compile "org.androidannotations:androidannotations-api:$AAVersion"

Use

//Annotation
apt "org.androidannotations:androidannotations:$AAVersion" 
compile "org.androidannotations:androidannotations-api:$AAVersion"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM