Android Studio 3.0 Dependency issue - android

Getting Error:
Error:Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.googlecode.mp4parser:isoparser:1.1.22.
Open FileShow Details
For Dependency:
compile 'com.googlecode.mp4parser:isoparser:1.1.22'
But for dependency:
compile 'com.googlecode.mp4parser:isoparser:1.1.20'
Gradle Sync Successfully.
Tried using repository:
repositories {
mavenCentral()
}
Detailed Error:
Unable to resolve dependency for ':app#StagingUnitTest/compileClasspath': Could not resolve com.googlecode.mp4parser:isoparser:1.1.22.
Could not resolve com.googlecode.mp4parser:isoparser:1.1.22.
Required by:
project :app
Could not resolve com.googlecode.mp4parser:isoparser:1.1.22.
Could not get resource 'https://repo1.maven.org/maven2/com/googlecode/mp4parser/isoparser/1.1.22/isoparser-1.1.22.pom'.
org.apache.http.ssl.SSLInitializationException: malformed input around byte 0
malformed input around byte 0
malformed input around byte 0

Just spent 1.5 hours investigating this. My root cause error was
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve io.fabric.tools:gradle:1.+.
Required by:
project :
> Could not resolve io.fabric.tools:gradle:1.+.
> Failed to list versions for io.fabric.tools:gradle.
> Unable to load Maven meta-data from https://repo1.maven.org/maven2/io/fabric/tools/gradle/maven-metadata.xml.
> org.apache.http.ssl.SSLInitializationException: malformed input around byte 12
In the idea.log file, I found this logtrace:
2018-02-15 18:32:32,220 [entQueue-0] ERROR - net.ssl.ConfirmingTrustManager - Cannot get system trust store
java.security.KeyStoreException: problem accessing trust storejava.io.UTFDataFormatException: malformed input around byte 12
at sun.security.ssl.TrustManagerFactoryImpl.engineInit(TrustManagerFactoryImpl.java:74)
at javax.net.ssl.TrustManagerFactory.init(TrustManagerFactory.java:250)
at com.intellij.util.net.ssl.ConfirmingTrustManager.getSystemDefault(ConfirmingTrustManager.java:82)
at com.intellij.util.net.ssl.ConfirmingTrustManager.createForStorage(ConfirmingTrustManager.java:75)
at com.intellij.util.net.ssl.CertificateManager.<init>(CertificateManager.java:130)
As it turns out the issue was not with Gradle at all, but with Android Studio's internal JRE runtime.
I got the same malformed input around byte 12 error when running keytool against the cacerts file for the android studio JRE
> keytool.exe -list -keystore /c/Program\ Files/Android/Android\ Studio/jre/jre/lib/security/cacerts
keytool error: java.io.UTFDataFormatException: malformed input around byte 12
I replaced the cacerts file in my android studio install with the one from my machine's java install and things are back to normal. My assumption is that the file was corrupted during the update to 3.0, which seems to be the consistent thread in the people who have seen this.
Hope this helps anyone still experiencing this issue.

Just make sure your root level gradle.build file is something like this. You need repo in both project and all project:
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
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 {
mavenCentral()
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I was able to resolve dependency:

After lots of research and analysis, re-installing android studio 3.0 resolves issue.

As I check isoparser artifact also available in jcenter repo.
so add jcenter in your repository link.
repositories {
mavenCentral()
jcenter()
google() // <- required, when artifact is in google repo
}

Add also these repos:
jcenter()
google()
if you are behind proxy there may be problems with https connection so you may force it to use http, by adding:
maven { url "http://jcenter.bintray.com/" }
maven { url "http://repo.maven.apache.org/maven2" }
maven { url "http://maven.google.com" }
UPDATE: Yesterday I faced the similar package error, tried everything but finally the only solution was deleting entire .gradle folder in user profile (not in project), or in user home directory in Linux. After that a long sync will start but finally everything will be ok.
It seems that this problem caused by gradle cache corrupted during AS update to the new release. It happen to me in both Windows and Fedora systems. And HTTP error message just set all people to seek the solutioin in the wrong way.

Make sure that "Offline work" in "Settings" -> "Build, execution, deployment" -> "Gradle" is disabled.

Related

Unable to resolve dependencies in Android Studio

I am connected to my organization network. I have enabled the proxy. Android studio is successfully able to download plugins and update using the proxy. But the build is never successful. During Gradle sync, the 'Run Build' is always failing. I can see in the status bar that none of the files are downloading.
The error received is -
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:29
There are several similar errors such as cannot resolve junit, layout, constraints. Etc etc.
My Android Studio version is 3.2.1.
I am on my organization network which doesn't allow any direct download. I am already using proxy but still, the same error exists.
Please help.
Please ensure you have "google()" in your source repository, so check your build.gradle file and ensure repositories part has at least these entries:
repositories {
google()
jcenter()
}
Reason is that Google specific libraries are not published in central Maven repo
add google inside repositories and allprojects-->repositories
repositories {
google()
jcenter()
}

Android Studio: Gradle Refresh Failed - Could not find com.android.tools.build:gradle:2.2.0-alpha6

I've just pulled down an Android project from git, and Android Studio is giving me the following error whenever I attempt to open it;
Error:Could not find com.android.tools.build:gradle:2.2.0-alpha6.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.jar
https://maven.fabric.io/public/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.pom
https://maven.fabric.io/public/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.jar
Required by:
newApp_Android:app:unspecified
I've installed Gradle locally, and set up environment paths via System.
Under Project Structure/Project, the following setup is in use;
Gradle Version : 2.10
Android Plugin Version : 2.2.0-alpha6
Android Plugin Repository : jcenter
Default Library Repository : jcenter
Could anyone point me in the right direction on this?
This is because the build process is unable to find the dependency in Maven repository. Add jcenter() along with mavenCentral() in your project level build.gradle file.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0'
}
}
So I had a similar error while I was trying to build ionic2 project for android. This happened after android studio updated gradle during its updates.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugApk'.
A problem occurred configuring project ':CordovaLib'.
Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
Could not find com.android.tools.build:gradle:2.2.3.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
Required by:
android:CordovaLib:unspecified
I read the above answers which pointed to update a 'build.gradle' file but turns out there were multiple files with that name in the project. What worked for me (and hopefully helpful to whoever is working on angular2/ionic2 project and having this issue) is updating the build.gradle file at
[rootOfPorject]/platforms/android/CordovaLib/build.gradle
This file was missing the jcenter() entry and now the repository part looks like this and works like a charm.
repositories {
jcenter()
mavenCentral()
}
Hope this saves time for someone else.
EDIT: As #rcerecedar mentioned, you might also need to add jcenter() in the following file as well.
[rootOfPorject]/platforms/android/build.gradle
In this file you should check its present in buildscript -> repositories and also optionally in allprojects -> repositories
1.Goto "C:\Program Files\Android\Android Studio\gradle\m2repository\com\android\tools\build\gradle"
2.See the Latest folder name , i.e "2.2.3" , Copy It.
3.Go to build.gradle(Module:yourapp) file ,
Place here:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
If you have firewall configured in your PC,try the following in gradle.properties.
systemProp.https.proxyHost=<proxyHostName>
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=<user id>
systemProp.https.proxyPassword=<password>
systemProp.https.nonProxyHosts=www.google.com|localhost
What worked for me was i did exactly what "geekydhaval" said, thanks again for that but I went back to the dependencies {
classpath 'com.android.tools.build:gradle:2.3.0' } and change from 2.3.2 to 2.3.0 and the build completed successfully.
Replace the gradle:2.2.0-alpha6 to gradle:2.2.0-alpha3.
If this doesn't work replace it to gradle:2.2.0-alpha2.
As gradle is updating the previous version will be replaced with new version so we have to change the gradle version in code as it would be referring to previous version and will show error like this
Could not resolve all dependencies for configuration ':classpath'.
Could not find com.android.tools.build:gradle:2.2.3.
Searched in the following locations:
file:/home/ubuntu/.m2/repository/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
file:/home/ubuntu/.m2/repository/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
https://oss.sonatype.org/content/repositories/snapshots/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
Required by:
:: Open file
The solution to this is that we add the repository in the build.gradle file
like
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
OR
GOTO the File Explorer and search
C:\Program Files\Android\Android Studio\gradle\m2repository\com\android\tools\build\gradle
and see the Gradle name with latest version like
Gradle 2.2.0
Gradle 3.2.1
Gradle 2.1.0
and select the latest version like 3.2.1 and paste it in the build.gradle file in dependencies section like
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'}

Gradle Project Sync Failed: Peer not authenticated

I'm getting the following error when trying to sync my Gradle project:
Gradle 'android_studio' project refresh failed
Error: Cause: peer not authenticated
Here's my project's 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:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
I'm not sure what the problem is, I tried changing my gradle path to 2.1.0, but that did nothing. Any ideas? I seem to get this damn error every time I open Android Studio...
Open your /gradle/wrapper/gradle-wrapper.properties file
replace 'https' with 'http' in the distributionUrl:
example distributionUrl=http\://services.gradle.org/distributions/gradle-2.10-all.zip
and also be sure to classpath 'com.android.tools.build:gradle:2.1.0' to do this
For anyone who may run into this issue in the future and find almost no one knows what's going on, here's the very subtle thing that was happening for me.
I had Charles proxy running in the background, set to only record for endpoints I wanted it to record for. This was causing it to block the traffic from Gradle when it was downloading wahtever it is Gradle downloads, which gave me the 'peer not authenticated' error. I eventually found this by looking in the logs and seeing a whole mess of SSL errors.
This error usually occur due to internet connections! Check your connection and sync again (rebuild project)

Force Gradle to use HTTP instead of HTTPS

I am trying to build react-native android app, as a dependecy I see I have gradle, but it fails to load on build.
Error message:
* What went wrong:
A problem occurred configuring root project 'MobileApp'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:1.3.1.
Required by:
:MobileApp:unspecified
> Could not resolve com.android.tools.build:gradle:1.3.1.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.1/gradle-1.3.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/1.3.1/gradle-1.3.1.pom'.
> Connection to https://jcenter.bintray.com refused
The issue is clear, I am sitting behind corporate proxy that blocks any HTTPSconnections like these in error.
So my questions are: how to force gradle to use HTTP in loading these files? Where these properties should be put(which of gradle files, i.e. gradle.properties)?
P.S. I already have set these in gradle properties file:
systemProp.http.proxyHost= myHost
systemProp.http.proxyPort= myPort
systemProp.http.proxyUser= myUser
systemProp.http.proxyPassword= myPassword
Any links, suggestions or etc. will help a lot.
I had same problem and fixed it.
gradle is forced to get dependencies from jcenter through https proxy.
if you add
maven { url "http://jcenter.bintray.com" }
in your repositories instead of jcenter(), gradle sees this repository as a simple maven repository with http proxy.
your project build.gradle should be like below:
buildscript {
repositories {
maven { url "http://jcenter.bintray.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
allprojects {
repositories {
maven { url "http://jcenter.bintray.com" }
}
}
replace jcenter() with jcenter { url "http://jcenter.bintray.com/"} in build.gradle
Try this
run a proxy like freegate
the root path project in cmd type
gradlew -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=8580
File -> Settings -> Project Settings -> Gradle -> Global Gradle Settings -> Gradle VM Options
-Dhttp.proxyHost=myProxyAddr
-Dhttp.proxyPort=myProxyPort
-Dhttp.proxyUser=myUsername
-Dhttp.proxyPassword=myPasswd
-Dhttp.auth.ntlm.domain=myDomainName
Go into the gradle/wrapper folder nearby and edit the gradle-wrapper.properties
Then add in a the https to the distribution URL and it should work.
distributionUrl=https\://services.gradle.org/distributions/gradle-1.10-bin.zip
^
Verify the file you are trying to grab is actually on the repo:
https://services.gradle.org/distributions/
Rerun your command to get the gradle wrapper version.
gradle wrapper
gradlew.bat wrapper -gradle-version="1.10"
Hope that helps.

Could not resolve all dependencies for configuration ':classpath'

I cant seem to get build tools for the latest gradle at all. I suspect its something to do with proxy setting for gradle. I have had a good look online but still cant seem to find a solution. I use gradle 2.1.
I created gradle.properties file in my /home/user/.gradle folder with these setting.
systemProp.http.proxyHost=proxy
systemProp.http.proxyPort=80
systemProp.http.proxyUser=myusername
systemProp.http.proxyPassword=password
systemProp.https.proxyHost=proxy
systemProp.https.proxyPort=80
systemProp.https.proxyUser=myusername
systemProp.https.proxyPassword=password
Here is my global build.gradle
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.0'
classpath fileTree(dir: 'build-libs', include: '*.jar')
}
}
allprojects {
repositories {
mavenCentral()
}
}
And here is the error i get when running gradlew
Could not HEAD 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/0.13.0/gradle-0.13.0.pom'.
peer not authenticated
What am I missing? that maven link opens fine in a browser.
Right, I'm not sure if it will work for others but worked for me.
I changed proxyPort to 8080 and used jcenter instead of Maven. But I had to apply expeption to use HTTP instead of HTTPS. This is what I have in my build.gradle for build script and allprojects
buildscript {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
allprojects {
repositories {
jcenter {
url "http://jcenter.bintray.com/"
}
}
}
UPDATE: 06/08
I have recently updated Gradle and plugin version and had some problems. It was complaining about plugin com.android.application
I did some digging around and changed
jcenter {
url "http://jcenter.bintray.com/"
}
to
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
Find and Replace:
jcenter()
maven {
url "https://maven.google.com"
}
to:
maven {
url "https://maven.google.com"
}
jcenter()
For newer android studio 3.0.0 and gradle update, this needed to be included in project level build.gradle file for android Gradle build tools and related dependencies since Google moved to its own maven repository.
// 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.0.1'
// NOTE: Do not place your application dependencies here; they belong
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'm using Gradle plugin 3.0.1 and saw this error. Not sure what caused this but the solution that works for me is to stop the running Gradle daemon by ./gradlew --stop.
The solution is in your build.gradle change this block:
allprojects {
repositories {
jcenter()
google()
}
}
to google in first position :
allprojects {
repositories {
google()
jcenter()
}
}
late but it worked for me:
change your dns setting by going Network and sharing center.
In left pane choose change adapter setting
-right click on your network connection
-properties
-select ipv4
-properties
- now in dns server setting:-
-choose the option use the following dns server addresses
and use google dns server 8.8.8.8 as preferred dns server and
8.8.4.4 as alternate dns server.
it will solve your problem.
In the Android Studio v4.0, you should be off the Gradle offline-mode and retry to sync Gradle.
I try to modify the repositories and import the cer to java, but both failed, then I upgrade my jdk version from 1.8.0_66 to 1.8.0_74, gradle build success.
I got the same problem. Just use File->INVALIDATE CACHES AND RESTART
6 years later here, but for them who are stil facing this issue, I solved it as following.
It happened when my module had a different gradle version than the main project. I had gradle version 3.5.3 in project and an older version in module. So, I Just updated that version. The file is here:
./node-modules/[module-name]/android/build.gradle
In my case deleting the .gradle folder worked for me.
In my case, my Android Studio version was 3.6.1 and i have modified the classpath like below;
classpath 'com.android.tools.build:gradle:3.6.1'
and that error was gone.
Go to
File --> Invalidate Caches / Restart.
It worked for me.
Android Studio > view > tool Windows > Gradle > click toggle offline mode (besides gradle settings icon)
this work for me :)
I had a same problem and I fix it with the following steps:
check the event log and if you see the errors like "cash version
is not available for the offline mode" follow the steps.
click on View => Gradle then new window will open.
click on the WIFI icon and then sync the Gradle.
"if you see different errors from what I mentioned in number one,
please go to the file -> project structure -> and there is suggestion"
Tools > SDK Manager > SDK Tools > Show Package Details
and remove all the old versions
I installed new Android Studio and faced with this problem. Nothing is helped me except of downloading a few more Android SDK versions:
Added Android Q and Android Pie to downloaded and installed SDK
Well if anyone facing with this problem after updating android studio to 4.2, the problem is about kotlin version. changing cotlin version line from "ext.kotlin_version = "1.5.0-release-764" to "ext.kotlin_version = "1.5.0" may solve your issue. Here is the link which has more information about it:
https://exerror.com/cant-create-new-kotlin-project-after-updating-to-android-studio-4-2/
You should have gradle-wrapper.properties inside gradle/wrapper folder.
Make sure you are using the right distributionURL, and the latest one. It should look something like this :
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
I Updated my android studio to latest version: Android Studio - Arctic Fox | 2020.3.1
Then it was showing this error. To solve this error, you have to follow these steps:
File>project Structure>project
Change Android Gradle Plugin version: 7.0.0 and Gradle Version: 7.0.2
then Go to file>setting>Build, Execution, Deployment>Build Tools>Gradle
change Gradle JDK to 11 version if it is 1.8 version.
if notification popup for Gradle upgraded then tap on it and click on run selected steps.
sync project and rebuild your project if necessary.
I hope it will work for you, Thanks me later.
I encountered a similar issue while building a Java project on Jenkins using Gradle.
When I run the build on Jenkins, at some point it throws the error below:
22:37:05 + GRADLE_OPTS='-Xms8192M -Xmx8192M'
22:37:05 + gradle clean build '-Dorg.gradle.jvmargs=-XX:MaxPermSize=4096M -Xms4096M -Xmx8192M' --full-stacktrace
22:37:05
22:37:05 Welcome to Gradle 5.6.4!
22:37:05
22:37:05 Here are the highlights of this release:
22:37:05 - Incremental Groovy compilation
22:37:05 - Groovy compile avoidance
22:37:05 - Test fixtures for Java projects
22:37:05 - Manage plugin versions via settings script
22:37:05
22:37:05 For more details see https://docs.gradle.org/5.6.4/release-notes.html
22:37:05
22:37:05 Starting a Gradle Daemon (subsequent builds will be faster)
22:37:14 > Task :my-service:clean UP-TO-DATE
22:37:18 > Task :my-service:compileJava FAILED
22:37:18
22:37:18 FAILURE: Build failed with an exception.
22:37:18
22:37:18 * What went wrong:
22:37:18 Execution failed for task ':my-service:compileJava'.
22:37:18 > Could not resolve all files for configuration ':my:compileClasspath'.
22:37:18 > Could not download spring-boot-autoconfigure.jar (org.springframework.boot:spring-boot-autoconfigure:2.1.14.RELEASE)
22:37:18 > Could not get resource 'https://nexus.my-test.network/repository/maven-public/org/springframework/boot/spring-boot-autoconfigure/2.1.14.RELEASE/spring-boot-autoconfigure-2.1.14.RELEASE.jar'.
22:37:18 > Premature end of Content-Length delimited message body (expected: 1276879; received: 496657
22:37:18
22:37:18 * Try:
22:37:18 Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Here's how I fixed it:
So first I looked the previous builds and they were building fine except this last one, also we had not changed anything in the build process.
The issue was with our Nexus artifactory server that has not been running fine. The server stops responding sometimes.
I just restarted the server and re-tried the build and it worked fine.
That's all
**A problem occurred evaluating project ':app'.
Could not resolve all files for configuration 'classpath'.**
Solution:
Platform->cordova-support-google-services
In this file
Replace
classpath 'com.android.tools.build:gradle:+' to this
classpath 'com.android.tools.build:gradle:3.+'
There seems to be many different causes to this problem. My cause is different from other posted answers, so I'll go ahead and explain what my problem was just in case it's useful.
I have a set of custom gradle plugins that for all practical purposes can be thought of as a wrapper around four familiar plugins: "com.android.application", "com.application.library", "java" and "java-library". These wrapper plugin are responsible for actually applying those familiar plugins, along with supplying configuration data. The result is that it simplifies the "build.gradle.kts" scripts for modules in my various projects.
My wrapper plugin for the "java-library". Is pretty straight forward. It applies the "java-library" plugin and adds the "sourceCompatibility" and "targetCompatibility" values. I followed the pattern that others have suggested on how to set those values. Essentially doing something like: "project.tasks.withType<JavaCompile> { sourceCompatibility = ... }" That's what caused my problem. I changed the above to:
val javaExt:JavaPluginExtension = project.extensions.get("java") as JavaPluginExtension
javaExt.sourceCompatibility = JavaVersion.toVersion( versions.getProperty("java-source-compatibility"))
javaExt.targetCompatibility = JavaVersion.toVersion( versions.getProperty("java-target-compatibility"))
And that solved the issue for me! The only useful information I got from gradle on resolving the problem is that it let me know the offending module, which was a module that didn't need any dependencies. In order to track down what was going on, I put the offending module into a separate project. That's where I discovered that the problem was definitely related to my custom "java-library" wrapper plugin.
I basically just removed jcenter() from my repositories of project gradle in buildscript block, since i declared it in my app gradle.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
mavenLocal()
mavenCentral()
jcenter() //remove this line
}
you should have gradle.properties file defined for the build with proxy settings so that gradle knows how to use http connection
# This file contains the basics for Maven Version control and will be used by the Artifactory Release management
# These settings are for the root project and all sub-projects in this application
releaseVersion=1.0.0-SNAPSHOT
releaseGroup=com.xx.xx.xx
artifactory_user=
artifactory_password=
artifactory_contextUrl=https://artifactory.xxxx.com/artifactory/
systemProp.http.proxyHost=proxy.xxx.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=proxy.xxx.com
systemProp.https.proxyPort=8080
systemProp.http.nonProxyHosts=*.xxx.com|localhost|*.int.targoe.com
org.gradle.java.home=C:\\Program Files (x86)\\Java\\jdk1.8.0_121
I had this issue and it was because I hadn't added an exception for gradle in my firewall (TinyWall).
I got this issue solved by switching internet from Wifi to mobile hot-spot. It means this issue occurs due to network issue. I could also see below logs which confirms my understanding,
Connect to jcenter.bintray.com:443
[jcenter.bintray.com/75.126.118.188] failed: Connection timed out:
connect
and
Connect to repo1.maven.org:443 [repo1.maven.org/151.101.36.209]
failed: Connection timed out: connect
Hope it helps.
If adding google() into your build.gradle doesn't work try adding it at first place in your repositories section of node_modules/YOUR_PACKAGE/android/build.gradle file.
I am working with flutter in the VS Code.
In my case, I solved it by
stopping gradlew process in VS code using the below command
android/gradlew --stop
I changed the ext.kotlin_version in "build.gradle" to the previous one (from 1.5.0 back to 1.4.32) and that worked for me. Maybe the current Gradle version wasn't compatible with it.

Categories

Resources