I have a dependency that looks like this:
dependencies {
apt 'io.sweers.barber:barber-compiler:1.3.0'
compile 'io.sweers.barber:barber-api:1.3.0'
}
This dependency does exist in both jcenter and mavenCentral, but whenever gradle resolves it, it uses the incorrect artifactId (dropping the "barber-" prefix).
Error:Could not find io.sweers.barber:api:1.3.0.
Searched in the following locations:
https://jcenter.bintray.com/io/sweers/barber/api/1.3.0/api-1.3.0.pom
https://jcenter.bintray.com/io/sweers/barber/api/1.3.0/api-1.3.0.jar
https://maven.fabric.io/public/io/sweers/barber/api/1.3.0/api-1.3.0.pom
https://maven.fabric.io/public/io/sweers/barber/api/1.3.0/api-1.3.0.jar
file:/Users/hsweers/dev/android/android-sdk/extras/android/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.pom
file:/Users/hsweers/dev/android/android-sdk/extras/android/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.jar
file:/Users/hsweers/dev/android/android-sdk/extras/google/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.pom
file:/Users/hsweers/dev/android/android-sdk/extras/google/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.jar
Required by:
MyAppProject.app:unspecified > io.sweers.barber:barber-compiler:1.3.0
If the dependency would resolve correctly to https://jcenter.bintray.com/io/sweers/barber/barber-api/1.3.0/barber-api-1.3.0.pom
If it helps, the library can be found here: https://github.com/hzsweers/barber
Turns out the problem is somewhere in my library and causing the generated pom for the compiler module to use the api module name rather than its artifactId. Hotfixed it for now
Related
This is the error while building the gradle.
[![Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.pierfrancescosoffritti.androidyoutubeplayer:core:10.0.5.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/pierfrancescosoffritti/androidyoutubeplayer/core/10.0.5/core-10.0.5.pom
- https://repo.maven.apache.org/maven2/com/pierfrancescosoffritti/androidyoutubeplayer/core/10.0.5/core-10.0.5.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
did you add mavenCentral()?please replace mavenCentral() instead of jcenter
The library is not maintained if you look at the repo on github the last commit was on Nov 11, 2019. So the maintainer has probably not published the library on mavenCentral. I suggest you download or clone the repo from Github and use it as a module in your project, or generate a jar or aar and use it as a locale library.
Add implementation fileTree(dir: "libs", include: ["*.jar"]) to your app level module dependency
I recently wrote a java module and pushed it to maven but when I test it,there are some errors:
Error:Could not find PreferenceAnnotion:preference-annotation:unspecified.
Searched in the following locations:file:/Applications/Android Studio.app/Contents/gradle/m2repository/PreferenceAnnotion/preference-annotation/unspecified/preference-annotation-unspecified.pom
....
Required by:
TestPlugin:app:unspecified > com.github.merlinyu:preference-processor:1.0.0
My module code dependencies:
compile project(':preference-annotation')
I don't know how to fix it.
the github :https://github.com/MerlinYu/PreferenceAnnotation
When you add Gradle dependency this way:
compile project(':preference-annotation')
Gradle searches for local Gradle module named preference-annotation.
It doesn't resolve the dependency through maven.
To include a dependency coming from a Maven repository you have to use this meta format (replace with proper values):
compile 'groupId:artifactId:version(:classifier)(#packaging)'
In your case you have to add:
compile 'com.github.merlinyu:preference-annotation:1.0.0'
actually i have been trying to import another gradle project as library from github and i know that there are two ways to do that
1)by adding url to dependencies in build.gradle file
this method gave lot of errors
2)manually download library and import it as module, then add dependencies
and i somehow succeeded by using second method ..
after that gradle sync worked correctly but while running application it gives some bizzare errors like
Error:(23, 0) Gradle DSL method not found: 'ompile()'
Possible causes:The project 'AppIntro' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
and the github link is as follows
https://github.com/PaoloRotolo/AppIntro
i imported folder called as library in that....
You can add this library in many ways:
Add a simple dependency in your build.gradle file
Just use:
dependencies {
compile 'com.github.paolorotolo:appintro:3.4.0'
}
Use the jitpack plugin
Just add this repo to your build.gradle
repositories {
// ...
maven { url "https://jitpack.io" }
}
And the dependency:
dependencies {
compile 'com.github.User:Repo:Tag'
}
download the module (the library folder) locally.
I have a project with two Android Gradle modules: a library, :mylib, and an app, :demo. In the build.gradle for :demo, I added a dependency on :mylib:
dependencies {
compile project(':mylib')
}
In turn, :mylib has this dependency:
dependencies {
compile 'com.google.code.ksoap2-android:ksoap2-android:3.5.0'
}
The repo is set up correctly, and :mylib built fine before I added the :demo module to the project. But now when I build, I get this:
Error:Gradle: A problem occurred configuring project ':demo'.
> Could not resolve all dependencies for configuration ':demo:_debugCompile'.
> Could not find com.google.code.ksoap2-android:ksoap2-android:3.5.0.
Searched in the following locations:
https://jcenter.bintray.com/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.pom
https://jcenter.bintray.com/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.jar
file:/home/kevin/local/android-sdk-linux/extras/android/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.pom
file:/home/kevin/local/android-sdk-linux/extras/android/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.jar
file:/home/kevin/local/android-sdk-linux/extras/google/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.pom
file:/home/kevin/local/android-sdk-linux/extras/google/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.jar
Required by:
MyProject:demo:unspecified > MyProject:mylib:unspecified
I don't understand why :demo is even aware that :mylib uses ksoap2, let alone why it tries to resolve the dependency itself. I don't think there's anything public or even protected in :mylib that exposes its use of ksoap2.
Since you are including a module, gradle is trying to resolve all nested dependencies (somenthing similar to a pom file).
The library com.google.code.ksoap2-android isn't in the jcenter or maven central repository and it is the reason of your issue.
Just add the repository where gradle can find this library.
I'm trying to Support eclipse IDE to use my aar based on this link
I encountered a problem when trying to iterate over compile dependncies
configurations.compile.filter {it.name.endsWith 'jar'}.each { File file -> moveJarIntoLibs(file)}
I got
Error:Could not find com.android.support:support-v13:22.1.1.
Searched in the following locations:
file:/C:/Users/myUser/.m2/repository/com/android/support/support-v13/22.1.1/support-v13-22.1.1.pom
file:/C:/Users/myUser/.m2/repository/com/android/support/support-v13/22.1.1/support-v13-22.1.1.jar
Required by:
com.company.project.sdk.android:project:3.0.0-SNAPSHOT
If I remark this line the build is successful.
Also, I have the support library installed.
Any ideas how to support Eclipse IDE / Resolve this problem?
It seems that the problem was related to the fact that support repository is not included automatically as a repository. I found the related issue in Android project issue 69270 and followed the suggestion of adding the local support repository as maven repository
repositories {
def androidHome = System.getenv("ANDROID_HOME")
mavenCentral()
maven {
url "$androidHome/extras/android/m2repository/"
}
}
Now the problem no longer occur.