android studio gradle sync issues help plz - android

I tried to import the project written around 2016, but the error occurred as below How do you solve these problems?
enter image description here
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.31'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my build.gradle
(https://github.com/udacity/ud839_Miwok/issues/143)
I tried the solution provided by the above site, but the problem was not solved Did I find the wrong solution?

Jcenter() is at the end of its life
add maven {url"https://jitpack.io"} below the jcenter() line.
However some additional tips.
Bump up the Gradle plugin to max 4.2.2 and the Gradle version to 6.9.2.
2.There might be outdated libraries which you'll have to update in build.gradle

Related

Android Studio Gradle: Please remove usages of `jcenter()` Maven repository from your build scripts / JCenter is at end of life

In Android Studio 4.2 there is a warning:
buildscript {
ext.kotlin_version = '1.5.0'
repositories {
google()
//jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
//jcenter()
mavenCentral()
}
}
If I remove jcenter() then it can't find some dependencies of my app project:
> Could not find org.koin:koin-core:2.0.1.
Required by:
project :app
> Could not find org.koin:koin-androidx-scope:2.0.1.
Required by:
project :app
> Could not find org.koin:koin-androidx-viewmodel:2.0.1.
Required by:
project :app
> Could not find com.google.ads.mediation:chartboost:8.1.0.0.
Required by:
project :app
In replace of jcenter() I added mavenCentral()
Move mavenCentral() above jcenter().
do a clean/build on your project.
comment out jcenter()
By moving mavenCentral() above jcenter(), mavenCentral() now becomes the primary repository for all non Google artifacts. By doing a clean and build, all artifacts are now moved to mavenCentral().
I had to look this up and tried it. I went from all heck breaking loose after I removed jcenter() to being able to build my final project for school again.
For koin, change the group id from org.koin to io.insert-koin - the latter is published on maven central.
For chartboost, you can use the following repo:
maven {
url "https://dl.bintray.com/google/mobile-ads-adapters-android/"
}
Also note that there are newer versions such as koin 2.2.2 / 3.0.1 and chartboost 8.2.0.0. Older versions are likely not republished in non-jcenter repos.
mvnrepository is a good service for locating packages.
just commenting out jcenter() will help,
mavencentral() is already above jcenter.
Locate all build.gradle files in your project folder tree, open them and replace jcenter() by mavenCentral(). It works for me most of the time.
It is interesting that the AndroidStudio project template still adds the ref to jcenter() to gradle, but then as soon as the project attempts to build it requests that you remove it.
I just delete it from the gradle file and then it works.
So there are two issues here.
First, we need to move MavenCentral above jCenter in all projects
Second, Android build tools version need to upgraded to 4.2.0 and above. As Android internal build tool dependencies are going to jCenter
dependencies {
classpath("com.android.tools.build:gradle:4.2.0")
}
It should work
Hope this will help
Go to App/Gradle Scripts/build.gradle (Project:---)
Change the jcenter() on build script{} and in all project repositories.
and Sync now.
This is how it looklike before.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and after.
buildscript {
repositories {
google()
mavencentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
}
}
allprojects {
repositories {
google()
mavencentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This might help someone.
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
...
}
}
I used this to resolve:
> Could not find com.github.parse-community.Parse-SDK-Android:parse:1.26.0.
Required by:
project :app
I got the same error, while i was using the Android Studio Artic Fox Beta - 3 but after change Android Studio as Canary Build the error gone
The solution I did was to change build:gradle version:
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
The solution is simpe
just Locate build.gradle and replace jcenter() by mavenCentral().
good luck

Failed to resolve 'com.github.bashizip:business-hours-picker:v1.1.0'

I am having a strange issue. I am adding this library for Business Hour Picking.
https://github.com/bashizip/business-hours-picker
But strangely the older versions are added with no issues. But when I add the latest one it is not resolving by gradle.
I have tried:
Clean Project
Rebuilt It
Invalidate Cache & Restart
But i can't add the library.
I have also posted the issue on the github issues section.
Here is my Project Level Gradle:
// 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
// Android Navigation Safe Args Classpath
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please try the newest version of the library (1.1.1):
implementation 'com.github.bashizip:business-hours-picker:1.1.1'
It has many improvements, bug fixes and Gradle dependencies have been upgraded.
PS: I'm the author of the lib.

Could not find com.android.tools.build:gradle:3.0.1. project from Github

I would like to open ten https://github.com/mukundmadhav/Wordpress-to-Android-app project in Android Studio. However, I have a problem.
I'm getting errors
ERROR: Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
project :
Add Google Maven repository and sync project
Open File
I tried to solve the problem with these methods
Gradle 4.1 issue on latest android studio 3.0.1
Could not find com.android.tools.build:gradle:3.0.1
Could not find com.android.tools.build.gradle:3.0.0-alpha7
However, nothing helped, does anyone know how to open this project?
Update:
Android Version 3.4.1
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
There should be google() repo in repositories which searches plugins/libraries in google repository.
Also, version number for com.android.tools.build should match the Android Studio Version. For example: for Android studio 3.4.1, classpath dependency should be:
classpath 'com.android.tools.build:gradle:3.4.1'
Here is the modified code for build.gradle.
// 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.4.1'
classpath 'com.google.gms:google-services:4.2.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
}
Check if google() is present in repositories in the top level build.gradle
allprojects {
repositories {
jcenter()
google()
}
}
P.S - If you're using Android Studio 3.1 or higher, you should be able to click on Add Google Maven repository and sync project and allow Android Studio to make the necessary corrections by itself and resync the gradle.

Could not download auto-value.jar (com.google.auto.value:auto-value:1.5.2): No cached version available for offline mode

I have almost tried everything I know, but still as soon as I update my Android studio to the latest version it shows this error.What should I do?
The gradle.build is:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven{
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I faced the same problem today. I solved it by downloading the auto-value.jar file manually. Then I added the jar file to the libs folder. After doing so I synced the gradle files.
Here are details on how to add a jar file into Android Studio.
https://stackoverflow.com/a/16628496/8065933
All the best.

Android Studio: Could not find com.android.tools.build:gradle:2.0.0-alpha2

Recently I have updated my Android Studio to latest version from Latest Android Studio Canary Build: 2.0 Preview
After updating to the new version, my current working directory stop working at all. Every single time when I am trying to clean and build a project they will give me an error like this
Blockquote
'Error:Could not find com.android.tools.build:gradle:2.0.0-alpha2.
Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.pom
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-alpha2/gradle-2.0.0-alpha2.jar
Required by:
:android 3:unspecified'
Anyone have an idea how to solve this problem. Thanks in advance.
UPDATE: I am using a Mac machine and installation directory look like
Apparently the build tools have been moved from maven to jcenter so you need to change the code from:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
}
}
to this
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
}
}
More details on the changes:
Android Tools Project Site
http://tools.android.com/recent
Android Developer Tools community https://plus.google.com/communities/114791428968349268860/stream/7f20992b-7d9a-4309-9d94-6fbe08f0ad6e
In the main build.gradle file, add jcenter() as main repo, just like that :
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
}
}
allprojects {
repositories {
jcenter()
}
}
Remove other repositories or make sure jcenter is the first one.
On my side travis build failed with error message "Could not find com.android.tools.build:gradle:3.0.1".
After addeing google() as additional repository the problem was gone.
buildscript {
repositories {
jcenter()
google()
My local build did not fail because i had installed before "com.android.tools.build:gradle:3.0.1" with anddroid-sdk-manager
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
repositories block should be in buildscript.
Check to see if gradle 2.0.0-alpha1 is available on your system. Look in your android/tools/build/gradle folder. In my case, despite the confusing message "This project is using a preview version of the Gradle plugin (2.0.0-alpha2) and a newer version is available (2.0.0-alpha2) You can update to 2.0.0-alpha2." the version in my folder was 2.0.0-alpha1, and changing my build.gradle to:
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
fixed my build problem.
I removed the newest folder gradle-4.1-all in C:\Users\YOUR_USER_NAME\ .gradle\wrapper\dists\ and then I created a new project in Android Studio and the following message disappeared:
"Gradle sync failed: Could not find com.android.tools.build: Gradle:
3.0.0-beta6. "
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried something like
platfoms > android > cordova >lib > builders > Gradlebuilder.js
Downloaded zip and given path
var distributionUrl = process.env['CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'] || 'file\:///C:/MyPC/Documents/softwares/gradle-2.14.1-all.zip';
and linking path is
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven{url "http://jcenter.bintray.com"}
}
}
It worked for me.
this is for Ionic developers *
This seems to be a very long issue(years on the making)...most of the hints are about settings and gradle scripts. After a few days of digging around and backing from BumbleBee to 3.4.2 I kept on getting the same issue no matter what I tried. In the end the gradle on line URLs are blocked for my location due to network ... so easy for Google to say check the access is proper and not keep us blindfolded throwing darts in the dark

Categories

Resources