Gradle project refresh failed (AS 0.8.2, Mac) - android

With a blank new project, I get this:
Gradle 'HelloWorld' project refresh failed
Error:Cause: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
When trying to build I get the following Gradle Build error:
Error:A problem occurred configuring root project 'HelloWorld'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:0.12.+.
Required by:
:HelloWorld:unspecified
> org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
This is a fresh installation of Android Studio, and my build.gradle looks like:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
The first lines of the relevant log error are:
org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.12-all.zip'.
Caused by: org.gradle.internal.exceptions.LocationAwareException: A problem occurred configuring root project 'HelloWorld'.
Caused by: org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'HelloWorld'.
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':classpath'.
Caused by: org.gradle.api.internal.artifacts.ivyservice.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:0.12.+.
Caused by: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
The project structure is just the default for a new project with a blank activity:

For me it look like incompatible versions. So this problem is related to this problem: Android Studio says to use Gradle 1.10 - but new version is 1.12?
Try to use gradle 1.10 and delete the the folder of the gradle wrapper.

Try mavenCentral() instead of jcenter()
Looks like this is a known issue..
https://code.google.com/p/android/issues/detail?id=73511

Related

Intellij getting SocketTimeoutException while trying to resolve dependencies with gradle on open network

Details:
No proxy network
Have tried increasing timeout in gradle.properties
Can download file from browser
Intellij - Ultimate Edition - Build #IU-222.4167.29, built on September 13, 202
Gradle version in gradle-wrapper.properties - gradle-7.4.2
Same behaviour seen with Android Studio
Not exactly sure since when problem exists as I had commented out task clean for sometime and started seeing the problem after I invalidated cache by clearing files.
Here is my build.gradle file details:
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id("org.jetbrains.kotlin.jvm") version "1.7.10"
}
configurations.all {
resolutionStrategy { force 'androidx.core:core-ktx:1.7.10' }
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Stacktrace:
Starting Gradle Daemon...
Gradle Daemon started in 795 ms
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:7.1.2.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:7.1.2.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom'.
> Read timed out
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10.
> Could not get resource 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.7.10/kotlin-gradle-plugin-1.7.10.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.7.10/kotlin-gradle-plugin-1.7.10.pom'.
> Read timed out
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'android'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:84)
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:77)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$400(LifecycleProjectEvaluator.java:55)
at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.lambda$run$0(LifecycleProjectEvaluator.java:111)
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':classpath'.
.
.
Cause 1: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:7.1.2.
Required by:
project :
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:7.1.2.
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom'.
at org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
at org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadByCoords(DefaultExternalResourceArtifactResolver.java:144)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadStaticResource(DefaultExternalResourceArtifactResolver.java:94)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.resolveArtifact(DefaultExternalResourceArtifactResolver.java:60)
at org.gradle.api.internal.artifacts.repositories.metadata.AbstractRepositoryMetadataSource.parseMetaDataFromArtifact(AbstractRepositoryMetadataSource.java:78)
at org.gradle.api.internal.artifacts.repositories.metadata.AbstractRepositoryMetadataSource.create(AbstractRepositoryMetadataSource.java:68)
at org.gradle.api.internal.artifacts.repositories.metadata.DefaultMavenPomMetadataSource.create(DefaultMavenPomMetadataSource.java:40)
at org.gradle.api.internal.artifacts.repositories.metadata.RedirectingGradleMetadataModuleMetadataSource.create(RedirectingGradleMetadataModuleMetadataSource.java:51)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.resolveStaticDependency(ExternalResourceResolver.java:245)
at org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver.doResolveComponentMetaData(MavenResolver.java:121)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver$RemoteRepositoryAccess.resolveComponentMetaData(ExternalResourceResolver.java:475)
.
.
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.2/gradle-7.1.2.pom'.
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:130)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRawGet(HttpClientHelper.java:92)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performGet(HttpClientHelper.java:96)
at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:45)
at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:30)
at org.gradle.internal.resource.transfer.AbstractExternalResourceAccessor.withContent(AbstractExternalResourceAccessor.java:32)
at org.gradle.internal.resource.transfer.DefaultExternalResourceConnector.withContent(DefaultExternalResourceConnector.java:59)
at org.gradle.internal.resource.transfer.ProgressLoggingExternalResourceAccessor$DownloadOperation.call(ProgressLoggingExternalResourceAccessor.java:122)
Cause 2: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10.
Required by:
project :
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10.
Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.7.10/kotlin-gradle-plugin-1.7.10.pom'.
at org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
at org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadByCoords(DefaultExternalResourceArtifactResolver.java:144)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadStaticResource(DefaultExternalResourceArtifactResolver.java:94)
at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.resolveArtifact(DefaultExternalResourceArtifactResolver.java:60)
at org.gradle.api.internal.artifacts.repositories.metadata.AbstractRepositoryMetadataSource.parseMetaDataFromArtifact(AbstractRepositoryMetadataSource.java:78)
at org.gradle.api.internal.artifacts.repositories.metadata.AbstractRepositoryMetadataSource.create(AbstractRepositoryMetadataSource.java:68)
at org.gradle.api.internal.artifacts.repositories.metadata.DefaultMavenPomMetadataSource.create(DefaultMavenPomMetadataSource.java:40)
at org.gradle.api.internal.artifacts.repositories.metadata.RedirectingGradleMetadataModuleMetadataSource.create(RedirectingGradleMetadataModuleMetadataSource.java:51)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.resolveStaticDependency(ExternalResourceResolver.java:245)
at org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver.doResolveComponentMetaData(MavenResolver.java:121)
at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver$RemoteRepositoryAccess.resolveComponentMetaData(ExternalResourceResolver.java:475)
.
.
Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET 'https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.7.10/kotlin-gradle-plugin-1.7.10.pom'.
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRequest(HttpClientHelper.java:130)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performRawGet(HttpClientHelper.java:92)
at org.gradle.internal.resource.transport.http.HttpClientHelper.performGet(HttpClientHelper.java:96)
at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:45)
at org.gradle.internal.resource.transport.http.HttpResourceAccessor.openResource(HttpResourceAccessor.java:30)
at org.gradle.internal.resource.transfer.AbstractExternalResourceAccessor.withContent(AbstractExternalResourceAccessor.java:32)
at org.gradle.internal.resource.transfer.DefaultExternalResourceConnector.withContent(DefaultExternalResourceConnector.java:59)
at org.gradle.internal.resource.transfer.ProgressLoggingExternalResourceAccessor$DownloadOperation.call(ProgressLoggingExternalResourceAccessor.java:122)
.
.
Caused by: java.net.SocketTimeoutException: Read timed out
at java.base/sun.nio.ch.NioSocketImpl.timedRead(NioSocketImpl.java:283)
at java.base/sun.nio.ch.NioSocketImpl.implRead(NioSocketImpl.java:309)
at java.base/sun.nio.ch.NioSocketImpl.read(NioSocketImpl.java:350)
at java.base/sun.nio.ch.NioSocketImpl$1.read(NioSocketImpl.java:803)
at java.base/java.net.Socket$SocketInputStream.read(Socket.java:966)
at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
* Get more help at https://help.gradle.org
BUILD FAILED in 15m 5s
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings
4:03:25 pm: Execution finished '--stacktrace'.
Reaching out after trying for 3 days. I'll be thankful if anyone can pinpoint the cause.
TA
Known issues are stated here https://developer.android.com/studio/known-issues
In my cases I had to add following line to ~/.zshrc file
export _JAVA_OPTIONS="-Djava.net.preferIPv6Addresses=true"

Why removing jcenter() repository fails my Android Application build for sqlite-android:3.36.0

I've updated my Android Application gradle to use AGP 7.0
my gradle repositories resembles this
repositories {
google()
mavenCentral()
jcenter()
}
This shows that JCenter Maven repository is no longer receiving updates: newer library versions may be available elsewhere
When I remove jcenter() my build fails with this error
* What went wrong:
Execution failed for task ':app:mergeDevelopmentDebugNativeLibs'.
> Could not resolve all files for configuration ':app:developmentDebugRuntimeClasspath'.
> Could not find io.requery:sqlite-android:3.34.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/requery/sqlite-android/3.34.1/sqlite-android-3.34.1.pom
- https://repo.maven.apache.org/maven2/io/requery/sqlite-android/3.34.1/sqlite-android-3.34.1.pom
Required by:
project :app > project :background:worker > project :background:database
As my application employs api 'io.requery:sqlite-android:3.34.1'
The requery GitHub README.md file states I need to use the following gradle entry
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
However adding the above does not fix my gradle build error
Where am I going wrong?
I updated to sqlite-android:3.36.0 and stil get...
* What went wrong:
Execution failed for task ':app:mergeDevelopmentDebugNativeLibs'.
> Could not resolve all files for configuration ':app:developmentDebugRuntimeClasspath'.
> Could not find io.requery:sqlite-android:3.36.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/requery/sqlite-android/3.36.0/sqlite-android-3.36.0.pom
- https://repo.maven.apache.org/maven2/io/requery/sqlite-android/3.36.0/sqlite-android-3.36.0.pom
- https://jitpack.io/io/requery/sqlite-android/3.36.0/sqlite-android-3.36.0.pom
Required by:
project :app > project :background:worker > project :background:database
I have identified the issue
When I have this entry my build works:-
implementation 'com.github.requery:sqlite-android:3.36.0'
When I have this entry my build fails:-
api 'com.github.requery:sqlite-android:3.36.0'

Where have google moved the latest gradle tool

For new android studio tool with following build script
repositories {
mavenLocal()
mavenCentral()
google()
jcenter()
}
// Switch the Android Gradle plugin version requirement depending on the
// installed version of Gradle. This dependency is documented at
// http://tools.android.com/tech-docs/new-build-system/version-compatibility
// and https://issues.apache.org/jira/browse/CB-8143
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
}
}
I am getting following error.
A problem occurred evaluating root project 'android'.
Could not resolve all artifacts for configuration 'classpath'.
Could not find com.android.tools.build:gradle:4.0.1.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
Required by:
unspecified:unspecified:unspecified
There website shows that we need to add google in buildscript, which is right there.
https://developer.android.com/studio/releases/gradle-plugin

Androidx migration issue with React Native: Not able to build project on android

I was using the 0.55.4 version of react native, after androidx update unable to build project on android.
I tried follwing solution:
Updates in gradle.properties file:
android.useAndroidX = true
android.enableJetifier = true
Use Jetifier npm module.
Updated React-Native Version to 0.60.0, update classpath 'com.android.tools.build:gradle:3.3.0' in build.gradle
and all available solution till now but still problem exist.
also tried adding following code in main buil.gradle file
subprojects { subproject ->
if (subproject.name.contains('react-native-datetime-picker') || subproject.name.contains('react-native-geolocation-service')){
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
Getting following error:
In Android Studio-
ERROR: Unable to resolve dependency for ':react-native-geolocation-service#debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.0.
Show Details
Affected Modules: react-native-geolocation-service
In VSCode Terminal(when running build through react-native run-android)
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app
project :app > project :react-native-splash-screen
project :app > project :react-native-geolocation-service
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :react-native-datetime-picker
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :Toast
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > com.facebook.react:react-native:0.60.0
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :react-native-image-crop-picker > com.github.yalantis:ucrop:2.2.2-native

Problems using jitpack.io with Android Gradle

I'm currently trying to add dependencies with jitpack. I've followed the basic instructions:
repositories {
maven {
url "https:jitpack.io"
}
}
dependencies {
compile 'com.github.User:Repo:Tag'
}
But I'm still getting the following error:
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.github.jitpack:maven-simple:4f1c2c9033.
Searched in the following locations:
https:/#/jcenter.bintray.com/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.pom
https:/#/jcenter.bintray.com/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.jar
https:/#/jitpack.io/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.pom
https:/#/jitpack.io/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.jar
https:/#/repo1.maven.org/maven2/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.pom
https:/#/repo1.maven.org/maven2/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.jar
file:/C:/sdk/extras/android/m2repository/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.pom
file:/C:/sdk/extras/android/m2repository/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.jar
file:/C:/sdk/extras/google/m2repository/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.pom
file:/C:/sdk/extras/google/m2repository/com/github/jitpack/maven-simple/4f1c2c9033/maven-simple-4f1c2c9033.jar
Required by:
Plate:app:unspecified
Your jitpack url looks wrong.
It's:
url "https:jitpack.io"
but in my opinion it should be:
url "https://jitpack.io".

Categories

Resources