Synchronizing Gradle failed due to unknown issues with downloads - android

I have been trying to fix this error all day now. All I did in the morning was update the compiler I had on my Android Studio. That's when everything went horribly wrong. Since then I have uninstalled the compiler...
These are the types of errors I keep getting everytime I try sync gradle:
Gradle sync failed: Could not find org.jetbrains.kotlin:kotlin-stdlib-jre8:1.2.0.
Searched in the following locations:
https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.2.0/kotlin-stdlib-jre8-1.2.0.pom
https://maven.google.com/org/jetbrains/kotlin/kotlin-stdlib-jre8/1.2.0/kotlin-stdlib-jre8-1.2.0.jar
Is the latest and one I can't solve... things I've tried:
To solve the other problems I physically downloaded the jar files and
put them in the respective places (which failed with kotlin 1.2.0)...
I also added this to my gradle:
.
buildscript {
repositories {
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://jitpack.io' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
This fixed my other issues...
I tried running from offline mode which failed...
I tried downloading the files into the project and referencing it like this:
.
compile files('kotlin-stdlib-jre8-1.2.0.jar')
I have long since removed the compiler just stuck as to what to do... I couldn't find any way online to fix my problem

I faced this problem after updating to new Android Studio too. You need to provide the dependency with new Kotlin version explicitly. In your app level build.gradle file add:
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.30"
Also you might need to add other dependencies:
compile "org.jetbrains.kotlin:kotlin-stdlib:1.2.30"
compile "org.jetbrains.kotlin:kotlin-reflect:1.2.30"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.30"

Related

Android Studio: Unresolved reference despite Gradle sync successful after adding third party implementation. Works fine with previous version

I am trying to add this library:
https://github.com/blipinsk/ViewPropertyObjectAnimator
I have added this to my build.gradle file's dependencies:
implementation 'com.bartoszlipinski:viewpropertyobjectanimator:1.5.0'
The Gradle sync is successful after this too.
However when I try to use it:
ViewPropertyObjectAnimator.animate(this#CustomToolbar).topMargin(it).setDuration(200).start()
It keeps telling me Unresolved reference: ViewPropertyObjectAnimator. And I am unable to import as the com.bartoszlipinski doesn't exist when importing.
If I change the library version from 1.5.0 to 1.4.5:
implementation 'com.bartoszlipinski:viewpropertyobjectanimator:1.4.5'
it works fine and import works fine too.
I would prefer using the newer version instead of the old one. Where am I going wrong?
EDIT: I just noticed that even though Gradle sync is successful, it logs a warning:
Failed to resolve: com.bartoszlipinski:viewpropertyobjectanimator:1.5.0 Show in Project Structure dialog Affected Modules: app
And with the older version, I can see the library in the Android Studio's "External Libraries" but it's not there in the newer library version:
Edit 2: I think I figured it out. I came across this:
https://github.com/blipinsk/ViewPropertyObjectAnimator/issues/16
Using custom bintray repo is a bit unusual, and mavenCentral only has up to 1.4.5. Any chance of updating to 1.5.0 on mavenCentral too? Just curious, but technically bintray works well for me atm too
So it seems like mavenCentral doesn't have the updated version.
I recently came across this issue, I added jitpack repository to the settings.gradle file instead of the root file.
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven { url "https://jitpack.io" }
}
}
Implementation in the build.gradle file was the same.
implementation 'com.github.blipinsk:ViewPropertyObjectAnimator:1.5.0'
I was able to figure this out. I came across this:
https://github.com/blipinsk/ViewPropertyObjectAnimator/issues/16
Using custom bintray repo is a bit unusual, and mavenCentral only has up to 1.4.5. Any chance of updating to 1.5.0 on mavenCentral too? Just curious, but technically bintray works well for me atm too
So it seems like mavenCentral doesn't have the updated version. As a workaround, I added
maven { url "https://jitpack.io" }
to
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
and then change the dependency to:
implementation 'com.github.blipinsk:ViewPropertyObjectAnimator:1.5.0'

ERROR: No signature of method: com.crashlytics.tools.gradle.CrashlyticsPlugin.findObfuscationTransformTask()

I am getting the following error while trying to build my project on Android Studio:
ERROR: No signature of method:
com.crashlytics.tools.gradle.CrashlyticsPlugin.findObfuscationTransformTask()
is applicable for argument types: (java.lang.String) values:
[DevDebug]
How to solve this?
EDIT: Before proceeding to the solution below, please at first update to the latest stable version of fabric gradle tools and check if the problem is fixed. At the time of this edit, some claim that updating to version 1.31.2 has fixed the issue.
This seems to be an issue related to version "1.28.0" of "io.fabric.tools:gradle".
Usually this kind of problem occurs if groupId:artifactId:n.+ structure of versioning is used inside dependency (app level/project level). In this case:
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
Because it auto updates the version, and as a result, if there is any fatal error in the latest version, the project is likely to face a crash due to build/runtime error.
Android Studio always suggests: 'Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds...'
One working solution was found to be downgrading to a specific previous version like 1.27.1 or any other stable latest version prior to 1.28.0, like:
dependencies {
classpath 'io.fabric.tools:gradle:1.27.1'
}
Remember to check both gradle files (app level/project level) to see where the above dependency has been declared and change accordingly.
hey this error raised because of Many android developers uses
classpath 'io.fabric.tools:gradle:1.+'
like this so that compiler not find exactly match of the fabric version and error raise and also M. Arabi Hasan Sakib is right
classpath 'io.fabric.tools:gradle:1.28.0'
also raise this type of error, solution mentioned by M. Arabi Hasan Sakib is also working. I tried below code and its working for me hope it works for you people also or just replace the line like
classpath 'io.fabric.tools:gradle:1.27.1':
(Put this code into the build.gradle in app directory)
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.27.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven {
url "http://dl.bintray.com/lukaville/maven"
}
}

Failed to resolve: play-services-tasks-license [duplicate]

suddenly gradle is unable to build the same code that was working moments ago !
my project depends on google play service dependencies
it says :
Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar
I think the aar file was removed from google by mistake
Does anyone have any idea, what is going on?
Add google() repository in your build.gradle. And check that google() is before jcenter().
The problem seems to be with jcenter. I have spent hours together with this problem and your problem seems to be similar to mine and I think the following solution should work.
For some reason and for many libraries in jcenter, the pom files of many libraries are kept in place but corresponding aar files have been removed. This is also the case with play-services-basement library. Check the following here for reference ( pom file of play-services-basement is available at jcentre here but aar file is not available at jcentre here):
Solution :
In your project level gradle file , change the following block of code
allprojects {
repositories {
jcenter()
google()
}
}
to
allprojects {
repositories {
google()
jcenter()
}
}
why this works ?
In our first code block, when gradle tries to resolve a dependency in the repository(in my case,it was google-services-basement in jcentre repository), it ddi not get resolved as corresponding aar files has been removed. As a result , build fails with something like :
Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
In our second code block, google repository has been referenced before jcenter repository. When gradle build starts, it looks first in the libraries listed first in repositories{... for resolving any library that is used in the project. Now, when gradle tries to resolve play-services-basement in jcenter, it is successful in resolving dependency as corresponding aar file has been made available by google repository(the same aar file of latest version is not available in jcenter repository) which has been referenced before jcenter repository is assessed. Do check and let me know if that works.
IN Worked
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://jitpack.io'
}
maven {
url 'https://maven.google.com'
}
}

getting failed to resolve when adding dependency

I am trying to add an external dependency from jcenter
compile 'com.droidninja:filepicker:2.0.4'
but I keep getting these errors and I can't figure out what is going wrong.
I have seen the same errors come up in lot of projects but nobody seems to know whats going wrong.
The problem is not with the dependency you just added but the Android Support library's dependencies. The latest SDK updates move towards using the remote Google Maven repository instead of downloading everything to be available locally. In order to fix dependency resolution problems follow the Adding Support Libraries guide. Really briefly this is what you have to do:
Open your project's build.gradle (note that this is not the module's file!)
Add the Google Maven repo to the project repositories:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
It's also recommended to add the repo to the buildscript block too, so later on the Gradle plugins can be downloaded from there too:
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}

0.8.0 Gradle sync failed

So I'm trying to transfer to android studio but I've been getting this error all the time.
This is the only thing I'm getting in the log:
Error:Could not find method compile() for arguments [com.android.support:support-v4:20.0.0] on
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated#50a8e746.
Please install the Android Support Repository from the Android SDK
Manager. Open Android SDK Manager
The problem is that I have android support repo installed as well as pretty much everything else so I really don't have any idea how to fix this.
I've even tried deleting the .gradle and let it download again but it didn't fix anything.
Here's my build.gradle (I did make changes to it since I was getting a build error):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
// do not use dynamic updating.
compile 'com.android.support:support-v4:20.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Android SDK:
Don't put module-level dependencies in the buildscript block. The buildscript block is for dependencies for the build system itself, i.e. if you were adding more Gradle plugins. To add dependencies for your modules, place them in the build.gradle file in the module directory.

Categories

Resources