Could Not Find Method Compile() for Arguments Gradle

Could not find method compile() for arguments Gradle

It should be exclude module: 'net.milkbowl:vault:1.2.27'(add module:) as explained in documentation for DependencyHandler linked from here because ModuleDependency.exclude(java.util.Map) method is used.

How to fix the error Could not find method compile() for arguments [directory 'libs'] fundamentally?

react-native-geocoder compile issue:

You can fix this issue by replacing compile with implementation in node_modules/react-native-geocoder/android/build.gradle.

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.facebook.react:react-native:+"
}

changed to

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.facebook.react:react-native:+"
}

Compile method has been deprecated from gradle 4.0 and completely removed from gradle 7.0

Gradle Could not find method compile() for arguments

You already have

compile project(':javalib') 

in your :app project, you don't have to also inject the dependency from your root build.gradle. If you still want to do it from the root build.gradle, the correct way to do it is:

configure(':app') {
dependencies {
compile project(':javalib') // causes problems - NOT ANYMORE!
}
}

the virgin android studio head is what worked.

Full error : Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.Def

To fix it, change compile to implementation like this:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:22.1.1'
}

Could not find method compile() for arguments [com.android.support:appcompat-v7:25.0.0]

Sample ImageUse implementation rather than compile.
Compile is now depricated for gradle file.

implementation use Against compile.

testImplementation use Against testcompile.

runtimeOnly use Against runtime.

 implementation 'com.android.support:appcompat-v7:25.0.0'
implementation 'com.android.support:support-annotations:25.0.0'
implementation 'com.android.support:design:25.0.0'

These line will not enter in build.gradle(Project:Projectname)
These lines will be under build.gradle(Module:app)

   apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.waltonbd.myapplication"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/raw'] } }
}

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'
implementation 'com.android.support:design:28.0.0'
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'
}

Another one is build.gradle(Project:Projectname). Don't enter here.

buildscript {
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'

// 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
}

Could not find method compile() error react native version .68+

This issue can be fixed by editing the node modules of react-native-i18n package.

  1. Go to node_modules/react-native-i18n/android/build.gradle
  2. Replace compile "com.facebook.react:react-native:+"
    into implementation "com.facebook.react:react-native:+"
  3. Save the file and run react-native run-android

You can use patch-package to make and persist changes to node modules.

This can be done by first making changes to the package inside node_modules and then running the following command, with being the name of the package you just made changes to.

npx patch-package
patch-package will then create a patches folder with a file inside, representing your changes. This file can then be commited to git, and patches can be restored later by running npx patch-package (without any arguments).

Optional step:

Add the following in the script section of your package.json to automatically patch the dependency when you execute "npm install".

"postinstall": "npx patch-package"



Related Topics



Leave a reply



Submit