I'm totally new to android studio and came up to this error that says it can not download gradle-3.5.1.pom and gradle-3.5.1.jar from google or jcenter repositories. But when I tried downloading them manually it was easy and straight forward though.
Here is the error text :
ERROR: Could not find com.android.tools.build:gradle:3.5.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.pom
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.jar
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.1/gradle-3.5.1.jar
Required by:
project :
Open File
I know that this is going to make me crazy because these gradle stuff always been a problem to all.
Make sure you have google() repo in your project's level build.gradle file.
Here's an example:
build.gradle
buildscript {
repositories {
google() // check if you have this
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
}
}
allprojects {
repositories {
google() // and this
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Disable Offline Work in Android studio if you have enabled the checkbox and sync project.
Once the project is synced, you can enable the checkbox and run the app as long as you do not add another dependency manually.
It will automatically download the required dependencies.
File>Settings>Build>Gradle
Related
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.
So, My Friend who is in University wanted me to check out his Application,
He sent me the Project File and When I tried to Run it I was greeted with an Error Message that Detailed.
Could not Find com.android.tools.build:aapt2:3.3.2-5309881.
Any Help would be Highly Appreciated (:
Required by:
project: app
AAPT2 moved to Google's Maven repository, to use AAPT2, make sure that you have a google() dependency in your build.gradle file, as shown here:
buildscript {
repositories {
google() // here
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
}
}
allprojects {
repositories {
google() // and here
jcenter()
}
See: https://developer.android.com/studio/releases/#aapt2_gmaven
I was trying to gradle build a plain Java Android project. It was an ADT project imported to Android Studio. To my astonishment, at one point Gradle tried to download the Kotlin compiler!
* What went wrong:
Execution failed for task ':app:lint'.
> Could not resolve all files for configuration ':app:lintClassPath'.
> Could not download kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.2.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.2.0/kotlin-compiler-26.2.0.jar'.
> Read timed out
Why the heck did gradle attempt downloading a big package like the Kotlin compiler
How do I prevent that?
More generally, how do make gradle ask me before it tries to download anything or at least prevent it from downloading non-dependencies? Such things should be installed by my distro's package manager, after all!
1) Because Gradle supports linting Kotlin code, which requires parsing it, which is implemented using classes in the Kotlin compiler.
2) By not using the lint task I guess?
3) The Kotlin compiler is a dependency. Gradle requires a specific version of this dependency in a specific layout and in a specific location, and it can't use a version installed by your package manager.
change
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
to
buildscript {
repositories {
google()
maven {
url "https://maven2.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
google()
maven {
url "https://maven2.google.com"
}
jcenter()
}
}
I'm very new to Android studio and Gradle so please be specific with your suggestions.
I downloaded this git repository because I needed a template of an app with OCR integrated into it. The project was built in Eclipse so I used the Android Studio Import tool to convert it to an Android Studio project. After attempting to build the project and resolving the first few errors by clicking on the links inside the errors, I got the "Could not find method implementation()" error which I can't seem to resolve.
NOTE - I installed Android Studio just today so I have everything updated.
This is what my build.gradle file looks like:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
implementation 'com.rmtheis:tess-two:9.0.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
You need to add this
implementation 'com.rmtheis:tess-two:9.0.0'
in build.gradle app file under dependencies instead of build.gradle project file.
build.gradle
dependencies {
//...
implementation 'com.rmtheis:tess-two:9.0.0'
//...
}