Gradle build failed to resolve library - java

I am working on android (Java) and trying to consume websockets so I thought I would use this tutorial and they are using dependency org.java-websocket:Java-WebSocket:1.3.0 from this repo which has now become 1.3.1.
So I have in my modular build.gradle
dependencies {
...
compile 'org.java-websocket:Java-WebSocket:1.3.1'
...
}
and in my project / top level build.gradle I have
repositories {
jcenter()
maven { url 'http://clojars.org/repo' }
}
and I am getting error
Error:(49, 13) Failed to resolve: org.java-websocket:Java-WebSocket:1.3.1

Try it with lowercase:
compile 'org.java-websocket:java-websocket:1.3.1'
It worked for me.
Edit:
the project level gradle file:
buildscript {
repositories {
jcenter()
maven { url 'http://clojars.org/repo' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
allprojects {
repositories {
jcenter()
maven { url 'http://clojars.org/repo' }
}
}

I was also facing same issue ,I restarted Android Studio and sync again,it build successfully.

Related

Gluon Project - Springboot Dependencies not found when i run /.gradle run

Here is my issue :
When i run my mainClass as java application everything goes good :
but when i run ./gradle run springboot dependencies not found in the classPath :
the build.gradle : GitHub Repository link to file
Can anyone try to fix with me the issue i ll be more than glad !!!
I managed to resolve the issue by adding this in the build.gradle :
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://nexus.gluonhq.com/nexus/content/repositories/releases'
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:2.0.30'
classpath "org.springframework.boot:spring-boot-gradle-plugin:2.3.3.RELEASE"
}
}
apply plugin: 'application'
dependencies {
compile "org.springframework.cloud:spring-cloud-starter-feign:1.4.7.RELEASE"
}
And now when i run /.gradle run -> it shows

Android Gradle dependency error for "com.otaliastudios:cameraview:2.0.0-rcl"?

I'm trying to follow the steps applied in this video to implement "QR Code reader with Firebase ML in real time".
While adding this line in dependencies,
implementation 'com.otaliastudios:cameraview:2.0.0-rcl'
I got the following error
ERROR: Failed to resolve: com.otaliastudios:cameraview:2.0.0-rcl
implementation 'com.otaliastudios:cameraview:2.0.0-rcl'
Is that an L on the end ... it should be 1.
Try:
implementation 'com.otaliastudios:cameraview:2.0.0-rc1'
Update your project gradle
buildscript {
repositories {
jcenter()
google()
}
}
allprojects {
repositories {
jcenter()
google()
}
}
After clean project and sync gradle again.

Why does gradle try to download a Kotlin compiler during :app:lint?

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()
}
}

Android Studio 3.0 Canary 2: Failed to apply plugin, when using gradle 3.0.0-alpha2

I just updated to using Android Studio 3.0 Canary 2. Upon opening my project Android Studio suggested I update the gradle version to 3.0.0-alpha2. My goal is to use the "Enable advanced profiling" Run Configuration so I can run a realtime memory-analysis. However the instant my gradle version was updated, my project fails to build. I followed the update instructions here.
The only changes made were to my top-level build.gradle file and the gradle-wrapper.properties file.
My top-level build.gradle:
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
classpath 'com.github.Archinamon:GradleAspectJ-Android:2.3.0'
classpath 'me.tatarka:gradle-retrolambda:3.5.0'
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://repo.adobe.com/nexus/content/repositories/releases/' }
maven { url 'http://maven.localytics.com/public' }
}
}
And I updated the gradle-wrapper.properties distributionURL to:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
The error I get is:
Failed to apply plugin [id'com.archinamon.aspectJ']
And here is the offending part of my app-level build.gradle file:
import java.text.SimpleDateFormat
apply plugin: 'com.android.application'
apply plugin: 'com.archinamon.aspectj'
aspectj {
includeAspectsFromJar 'Android_MTAgent'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
....
}
So the problem seems to be with the aspectJ plugin. If I remove the plugin for aspectJ and the related aspectJ block (both shown above) then it compiles (I get a dimen error then though, but I already saw that mentioned elsewhere, so I guess that can be solved.)
I'd appreciate any pointers/ideas in regard to the above issue.
Change your project build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
}
and update your Archinamon classpath reference in the same build.gradle file to:
classpath 'com.github.Archinamon:GradleAspectJ-Android:3.0.2'

Android Maven Could not resolve dependencies for configuration

I'm facing this problem currently. The project did't have any build problems previously. Only today when I was trying to build it gives this error.
Gradle: A problem occurred configuring project ':Project'.
Could not resolve all dependencies for configuration ':Project:classpath'.
Could not download artifact 'org.ow2.asm:asm-analysis:4.0#jar'
Artifact 'org.ow2.asm:asm-analysis:4.0#jar' not found.
Seems like asm-analysis:4.0 is not found in maven repo.
(Is this link correct? http://search.maven.org/#browse%7C1692005229)
Inside my build.gradle file, I've set the repository to mavenCentral()
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
} }
I am not sure how to fix this problem, any suggestion is appreciated.
Thank you.
Faced the same problem, ow2.org has separate repository
buildscript {
repositories {
maven { url "http://repository.ow2.org/nexus/content/repositories/releases/" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}

Categories

Resources