Failed to resolve following three dependencies in Android studio - android-studio

dependencies {
...
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
//Lifecycle Extensions
implementation "android.arch.lifecycle:extensions:2.1.1"
//VegaLayoutManager
implementation "com.stone.vega.library:VegaLayoutManager:1.0.6"
//Algolia Search
implementation "com.algolia:instantsearch-android:2.4.0"
...
}
When I add these three dependencies in build.gradle(Module) file of my project in android studio and sync it, I get 3 warnings of "failed to resolve" these three dependencies.
And when I run my project, I get this error:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find android.arch.lifecycle:extensions:2.1.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/android/arch/lifecycle/extensions/2.1.1/extensions-2.1.1.pom
- https://repo.maven.apache.org/maven2/android/arch/lifecycle/extensions/2.1.1/extensions-2.1.1.pom
- https://jitpack.io/android/arch/lifecycle/extensions/2.1.1/extensions-2.1.1.pom
- https://maven.google.com/android/arch/lifecycle/extensions/2.1.1/extensions-2.1.1.pom
Required by:
project :app
> Could not find com.stone.vega.library:VegaLayoutManager:1.0.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/stone/vega/library/VegaLayoutManager/1.0.6/VegaLayoutManager-1.0.6.pom
- https://repo.maven.apache.org/maven2/com/stone/vega/library/VegaLayoutManager/1.0.6/VegaLayoutManager-1.0.6.pom
- https://jitpack.io/com/stone/vega/library/VegaLayoutManager/1.0.6/VegaLayoutManager-1.0.6.pom
- https://maven.google.com/com/stone/vega/library/VegaLayoutManager/1.0.6/VegaLayoutManager-1.0.6.pom
Required by:
project :app
> Could not find com.algolia:instantsearch-android:2.4.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/algolia/instantsearch-android/2.4.0/instantsearch-android-2.4.0.pom
- https://repo.maven.apache.org/maven2/com/algolia/instantsearch-android/2.4.0/instantsearch-android-2.4.0.pom
- https://jitpack.io/com/algolia/instantsearch-android/2.4.0/instantsearch-android-2.4.0.pom
- https://maven.google.com/com/algolia/instantsearch-android/2.4.0/instantsearch-android-2.4.0.pom
Required by:
project :app
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I've checked for the versions of these dependencies, all the versions exist. I'm using them with kotlin version 1.5.0.
What does it mean by "dependencies not resolving" and how should I resolve this issue?

Gradle looks at multiple repositories to find your dependency. In your case, it didn't find those in any of the repositories you declared in your repositories section.
You can check for available versions: InstantSearch Android or Lifecycle

Related

Android Studio 3.6.3 How to get rid of ERROR: Unable to resolve dependency for ':app#debug/compileClasspath' (androidx.fragment:fragment)

I'm tired of getting this error every third/fourth time I try to build project:
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve androidx.fragment:fragment:[1.2.0].
Show Details
Affected Modules: app
It also effects ':app#debugUnitTest/compileClasspath' and ':app#debugAndroidTest/compileClasspath' (shows the same error for them).
Also sometimes it goes after the following build error (internet connection is surely stable):
Unknown host 'repo.maven.apache.org: nodename nor servname provided, or not known'. You may need to adjust the proxy settings in Gradle.
Enable Gradle 'offline mode' and sync project
Learn about configuring HTTP proxies in Gradle
There were no changes in build.gradle files or any other gradle files before this error came.
It would be nice if you help to get rid of it. Gradle-plugin version = "1.3.71".

Can't launch Groovy Console - missing dependency javax/xml/bind/Unmarshaller

Groovy version: 2.5.1
Java version: 10.0.2
Trying to launch the groovyConsole I get the following:
$ groovyConsole
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/usr/local/opt/groovy/libexec/lib/groovy-2.5.1.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:114)
at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:136)
Caused by: java.lang.NoClassDefFoundError: Unable to load class org.apache.groovy.jaxb.extensions.JaxbExtensions due to missing dependency javax/xml/bind/Unmarshaller
at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:407)
at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)
at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:400)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.scanExtClasses(MacroMethodsCache.java:88)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.access$000(MacroMethodsCache.java:45)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$2.onModule(MacroMethodsCache.java:69)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:81)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModulesFrom(ExtensionModuleScanner.java:63)
at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:54)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.getMacroMethodsFromClassLoader(MacroMethodsCache.java:76)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$1.provide(MacroMethodsCache.java:53)
at org.codehaus.groovy.macro.transform.MacroMethodsCache$1.provide(MacroMethodsCache.java:50)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:123)
at org.codehaus.groovy.macro.transform.MacroMethodsCache.get(MacroMethodsCache.java:50)
at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.findMacroMethods(MacroCallTransformingVisitor.java:118)
at org.codehaus.groovy.macro.transform.MacroCallTransformingVisitor.visitMethodCallExpression(MacroCallTransformingVisitor.java:89)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:197)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
plus more.......................................
Also got the same issue when using java 11.0.2 and groovy 2.5.5 in IntelliJ.
Found this post that helps! https://www.logicbig.com/tutorials/misc/groovy/intellij.html
Basically have to add JAXB dependencies
Also you have to add JAXB dependencies if you are using Groovy 2.5.3 + Java 11 (also check out Java 11 related change). Groovy comes with extra JAXB Jars so we can add them. Open 'Project Structure' dialog, then select 'Dependencies' tab and add the dependencies as shown
Three suggestions are in the release notes for 2.5.1:
http://groovy-lang.org/releasenotes/groovy-2.5.html#Groovy2.5releasenotes-Addendum251
In 2.5.2, probably a week or two away, you won't need to do them - grab the snapshot version from the CI server if you want to try it out now.
I've also got this when I debugged some my groovy scripts with groovy 2.5.4 and java 10.
Setting JAVA_OPTS=--add-modules java.xml.bind solved the mentioned problem for me.
I was able to solve this by adding the jaxb module to my gradle file. I like this solution because it changes your project configuration file instead of going into the IDE settings.
dependencies {
implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '3.0.1'
implementation group: 'org.codehaus.groovy', name: 'groovy-jaxb', version: '3.0.1'
}
In case someone has had the same problem and other solutions didn't help, here what helped me:
Added "jaxb" dependency to my project.
Go to Run -> Edit configurations -> Templates -> Gradle -> In Gradle Project choose your own application.

Cannot compile showcaseview library on Android

I'm trying to use the ShowcaseView project in my project on Android Studio but can't get the project to build.
Showcase link: https://github.com/amlcurran/ShowcaseView
I have included the following:
In app/build.gradle-
compile 'com.github.amlcurran.showcaseview:library:5.4.1'
In build.gradle-
repositories
{
mavenCentral()
}
I get the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not resolve com.github.amlcurran.showcaseview:library:5.4.1.
Required by:
BLEDemo:app:unspecified
> Could not resolve com.github.amlcurran.showcaseview:library:5.4.1.
> Could not get resource 'https://jcenter.bintray.com/com/github/amlcurran/showcaseview/library/5.4.1/library-5.4.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/github/amlcurran/showcaseview/library/5.4.1/library-5.4.1.pom'.
> Connection to https://jcenter.bintray.com refused
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Ive tried several suggestions online but couldn't find a solution to this.
I have also tried to import the library an include it in settings.gradle and get an error.
Can some please help me.
Thank you in advance.
It looks like gradle is searching for the library in jCenter. If you add jCenter to your repositories closure does it work? Like this:
repositories
{
mavenCentral()
jCenter()
}
Are there any proxy-servers in use in your environment? If yes: configure it with your user and password. The build cannot find the package, which is located on github and breaks with an error.
You can check this answer if you want to learn more how to do this: gradle-behind-proxy-in-android-studio-1-3

Failed to find: io.realm:realm-android:0.71.0

Since yesterday, I got Failed to find: io.realm:realm-android:0.71.0.
It is in my dependencies:
dependencies {
...
compile 'io.realm:realm-android:0.71.0'
...
}
Is this a bug?
The project compiled perfectly before.
What has changed since then:
Added Crashlytics
Bumped buildtoolsversion: buildToolsVersion "21.1.0"
Log:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_paidDebugCompile'.
Could not find io.realm:realm-android:0.73.1.
Searched in the following locations:
https://repo1.maven.org/maven2/io/realm/realm-android/0.73.1/realm-android-0.73.1.pom
https://repo1.maven.org/maven2/io/realm/realm-android/0.73.1/realm-android-0.73.1.jar
file:/C:/Users/thomasbeerten/.m2/repository/io/realm/realm-android/0.73.1/realm-android-0.73.1.pom
file:/C:/Users/thomasbeerten/.m2/repository/io/realm/realm-android/0.73.1/realm-android-0.73.1.jar
http://download.crashlytics.com/maven/io/realm/realm-android/0.73.1/realm-android-0.73.1.pom
http://download.crashlytics.com/maven/io/realm/realm-android/0.73.1/realm-android-0.73.1.jar
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/android/m2repository/io/realm/realm-android/0.73.1/realm-and
roid-0.73.1.pom
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/android/m2repository/io/realm/realm-android/0.73.1/realm-and
roid-0.73.1.jar
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/google/m2repository/io/realm/realm-android/0.73.1/realm-andr
oid-0.73.1.pom
file:/C:/Users/thomasbeerten/sdk backup/sdk/extras/google/m2repository/io/realm/realm-android/0.73.1/realm-andr
oid-0.73.1.jar
Required by:
YoMommaOClock:app:unspecified
Christian from Realm here. Thats odd, neither of these two things should have any effect on Realm.
Without further information i would check:
1) Do you have the following in your build.gradle file?
repositories {
jcenter()
}
2) Try running "./gradlew clean assemble --refresh-dependencies" from your project. That should refresh your local dependency cache.
Apart from that, we just released 0.73.1, I would suggest you upgrade to that version :)
This question already has an accepted answer but in case you still having problems like me, this is what worked for me i unchecked offline work at
settings -> build... -> build tools -> build->gradle
but before make sure you have jcenter() in your dependency as described in the accepted answer.

Encountering errors of obtaining dependencies when starting grails application

I'm new to Grails web framework. I got this error when running my first grails app from the terminal. Below is the error I got.
> | Downloading:
> org/apache/commons/commons-parent/17/commons-parent-17.pom | Error
> Resolve error obtaining dependencies: Failed to read artifact
> descriptor for org.hamcrest:hamcrest-core:jar:1.3 (Use --stacktrace
> to see the full trace)
>
> | Error Required Grails build dependencies were not found. This is
> normally due to internet connectivity issues (such as a misconfigured
> proxy) or missing repos itories in grails-app/conf/BuildConfig.groovy.
> Please verify your configuration to continue.
I'm running this app with the internet connection but this error still occurs. How can I fix this error?
are u sure you are using a the correct download for grails, it seems that your trying to connect to the internet and your grails can't ? may be check your proxy settings? or what you are really trying to do in the command line ?
Your console log says, you can not connect to internet for downloading dependencies.
But its not the case. Maven has stopped http repositories and that is the root cause.
You have to use https. If you could not connect to https for some reason, here is workaround to that:
mavenRepo "http://insecure.repo1.maven.org/maven2/"
Putting above line in BuildConfig.groovy will resolve your issue and start downloading dependencies.
What mavenRepo's do you have in your BuildConfig.groovy. I found that I had to add a few, here's mine:
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
mavenRepo "http://repository.codehaus.org"
mavenRepo "http://download.java.net/maven/2/"
mavenRepo "http://repository.jboss.com/maven2/"
mavenRepo 'http://repo.spring.io/milestone'
}
Have you tried running:
grails refresh-dependencies
before you try to run your app?
What version of Grails, SO and JDK do you have?, in Windows 8 with JDK Java SE 7u45 and Grails 2.3.1 i have a lot of problems; I had to make a downgrade to JDK

Resources