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]
Use 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.
- Go to node_modules/react-native-i18n/android/build.gradle
- Replace compile "com.facebook.react:react-native:+"
into implementation "com.facebook.react:react-native:+" - 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
How to Stop a Scheduled Task That Was Started Using @Scheduled Annotation
Creating Classes Dynamically with Java
How to Stop Selenium from Creating Temporary Firefox Profiles Using Web Driver
Does Java Support Inner/Local/Sub Methods
Port of Random Generator from C to Java
How to Encode Uri Parameter Values
How to Add a New Sourceset to Gradle
In What Situations Is the Copyonwritearraylist Suitable
Calling Virtual Method in Base Class Constructor
How to Get the Current Date and Time of Your Timezone in Java
Can't a Swing Component Be Added to Multiple Containers
Counting the Number of Files in a Directory Using Java
Kill -3 to Get Java Thread Dump
Java: Text to Speech Engines Overview
Random "Element Is No Longer Attached to the Dom" Staleelementreferenceexception
Java Int to String - Integer.Tostring(I) VS New Integer(I).Tostring()
Grab a Segment of an Array in Java Without Creating a New Array on Heap