Archinamon / android-gradle-aspectj

gradle plug-in adding supports of AspectJ into Android project
Apache License 2.0
365 stars 58 forks source link

Unable to find method 'org.gradle.api.file.ProjectLayout.files([Ljava/lang/Object;)Lorg/gradle/api/file/FileCollection;' #82

Closed luanalbineli closed 5 years ago

luanalbineli commented 5 years ago

Hi guys,

I'm trying to add Aspectj on my android application, but I'm currently facing an error when I try to sync the gradle files:

Unable to find method 'org.gradle.api.file.ProjectLayout.files([Ljava/lang/Object;)Lorg/gradle/api/file/FileCollection;'

I'm currently using AS 3.2.1 and Gradle 4.6

Archinamon commented 5 years ago

Hi! Does it the latest 3.3.0 plugin?

luanalbineli commented 5 years ago

Hi @Archinamon, sorry to forget to mention it, but yes, it's 3.3.0. I also tested with 3.2.0.

SynergySaugat commented 5 years ago

Unable to find method 'org.gradle.api.file.ProjectLayout.files([Ljava/lang/Object;)Lorg/gradle/api/file/FileCollection;'. 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. same issue here...

repositories { // ... maven { url "https://jitpack.io" } maven { url 'https://github.com/Archinamon/GradleAspectJ-Android/raw/master' } } implementation "com.archinamon:android-gradle-aspectj:3.3.0" apply plugin: 'com.archinamon.aspectj' classpath 'com.archinamon:android-gradle-aspectj:3.3.0'

Archinamon commented 5 years ago

@luanalbineli try to update Android Gradle plugin to 3.0.1 at least or higher.

SynergySaugat commented 5 years ago

@luanalbineli try to update Android Gradle plugin to 3.0.1 at least or higher.

that did not solved the issue...i used the latest gradle plugin 3.2.1 still the same problem..

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

buildscript {

repositories {
    google()
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.0.1'
    classpath 'com.archinamon:android-gradle-aspectj:3.3.0'

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

}

allprojects { repositories { google() jcenter() } }

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

//module: app apply plugin: 'com.android.application'

android { compileSdkVersion 28 defaultConfig { applicationId "com.example.aoparchinamon" minSdkVersion 15 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }

dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } apply plugin: 'com.archinamon.aspectj' //issue Unable to find method 'com.android.build.gradle.internal.variant.BaseVariantData.getTaskContainer()Lcom/android/build/gradle/internal/scope/TaskContainer;'. 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.

luanalbineli commented 5 years ago

@Archinamon Hi, sorry for the late reply, but I'm also using Android Gradle plugin 3.2.1, the lastest version.

srouvier commented 5 years ago

Hi,

I had the same issue and I solved it by using 3.3.1 version of Android Gradle plugin

DJAG95 commented 4 years ago

Hi,

i find my solution changing distributionUrl from gradle-wrapper.propierties, in my case, cordova create with other no compatible version of gradle

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

after change, reload the download,

i hope this reply can help anyone

brianlmerritt commented 4 years ago

Can confirm 4.10.3 works with cordova and ionic 5. It then does a gradle upgrade to 6.1.1 optionally which sets everything up ok and it works

Alexufo commented 4 years ago

I was helped by gradle version downgrade 6>5