I'm trying to use yelp-fusion-android library. I tried updating the gradle but no luck.
I am getting this error:
ERROR: Gradle DSL method not found: 'compile()'
Possible causes:
The project 'testProject' 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
Here is build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
// 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
}
Remove this line from the top-level file:
//compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
In the app/build.gradle file you can add the same dependency:
dependencies {
...
implementation 'io.github.ranga543:yelp-fusion-client:0.1.5'
...
}
Your problem is here
compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
Compile is deprecated use "Implementation" instead
and you are placing it in the wrong gradle there are 2 gradle files
please note this warning
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Place below dependency in app module instead of main project gradle.
compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
and replace compile with Implementation.
e.g (In app module)
Implementation 'io.github.ranga543:yelp-fusion-client:0.1.4'
dependencies section inside buildscript is not for module dependencies. Hence. move out compile 'io.github.ranga543:yelp-fusion-client:0.1.4' from this section and create top level dependencies block and put it there as below:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
// 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
}
dependencies {
compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
}
Also, if you have got submodule then you can add this dependency to the sub-module.
Related
There's a Java file I'm meant to convert to Kotlin. I'm stuck with this Gradle problem and can't find my way around it. What can I do to resolve this issue?
Go to build.gradle(Module)
and inside dependencies add the following line.
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
It should look something like this
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta6'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
After a while, I opened Android Studio and created a project called 'DaggerTest'. Unfortunately, when my Gradle is getting built, I face this error
A problem occurred configuring root project 'DaggerTest'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find bundletool-1.1.0.jar (com.android.tools.build:bundletool:1.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/1.1.0/bundletool-1.1.0.jar
> Could not find transform-api-2.0.0-deprecated-use-gradle-api.jar (com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/transform-api/2.0.0-deprecated-use-gradle-api/transform-api-2.0.0-deprecated-use-gradle-api.jar
> Could not find jetifier-processor-1.0.0-beta09.jar (com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta09).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-processor/1.0.0-beta09/jetifier-processor-1.0.0-beta09.jar
> Could not find jetifier-core-1.0.0-beta09.jar (com.android.tools.build.jetifier:jetifier-core:1.0.0-beta09).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/jetifier/jetifier-core/1.0.0-beta09/jetifier-core-1.0.0-beta09.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Here are the things that I have done and they did not work:
I allowed Android Studio(studio.exe, studio64.exe) and all java executable files in the windows firewall
I have disabled the windows firewall and it did not work.
I have tried some proxies in Android Studio HTTP proxy settings
I have changed my build Gradle file from this:
buildscript {
repositories {
google() // <-- here
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-beta03'
// 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
}
To this:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-beta03'
// 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
}
I got the following problem after updating the Gradle. I was not able to find any solution for it.
So please help me to solve the following problem.
Thanks in advance...
(PROBLEM-----Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom'. Received status code 406 from server: Not Acceptable)
My build.gradle file...
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.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
}
you should set build.gradle(project level)
classpath 'com.android.tools.build:gradle:4.0.1'
and in gradle-wrapper.properties file
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
then sync again project.
Android Gradle plugin 4.1.0 is not release yet. see on Google's Maven Repository. Try classpath 'com.android.tools.build:gradle:4.1.0-rc02' if you want to use 4.1.0.
I get this error. I'm pretty confused because i check everything in sdk manager and it's all updated (i think so).
Error:(30, 0) Could not find method compile() for arguments
[com.android.support:appcompat-v7:+] on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Please install the Android Support Repository from the Android SDK
Manager. Open Android SDK Manager
Is there something wrong with my code in build.grandle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.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
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
or is something missing...?
You can't use the compile() DSL in the top level file.
Delete this block:
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
and add the dependency in the dependencies block inside the app/build.gradle file.
You should not use "compile" when using Gradle build tools 3.0.0.
"compile" has been replaced with "implementation".
And you can't add dependencies in the project build.gradle file.
You have to add dependencies in the module build.gradle file.
So in the build.gradle file in the "app" directory, add these lines:
dependencies {
implementation 'com.android.support:appcompat-v7:+'
}
The "dependencies" block might already be there, if so, just add the contents to the original block.
In Android Stdio,We can see as following.
classpath 'com.android.tools.build:gradle:1.5.0'
I know that the this code is for gradle dependencies with jar.
But I cannot find the this jar locally.
How can I find this jar?
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Gradle caches by default will be here
~/.gradle/caches/jars-<number>/<hash of jar>/<jar name>.jar
or
~/.gradle/caches/modules-<number>/files-<number>/<group id>/<artifact id>/<version>/<file hash>/<jar name>.jar