Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
luanalbineli opened this issue Nov 8, 2018 · 10 comments

Comments

@luanalbineli
Copy link

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
Copy link
Owner

Hi!
Does it the latest 3.3.0 plugin?

@luanalbineli
Copy link
Author

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

@SynergySaugat
Copy link

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:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
    Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
    Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
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
Copy link
Owner

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

@SynergySaugat
Copy link

SynergySaugat commented Nov 27, 2018

@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:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
    Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
    Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

@luanalbineli
Copy link
Author

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

@srouvier
Copy link

Hi,

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

@DJAG95
Copy link

DJAG95 commented Jun 23, 2020

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
Copy link

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
Copy link

Alexufo commented Jul 4, 2020

I was helped by gradle version downgrade 6>5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants