Import RealmRecyclerViewAdapter throught mavenCentral() instead of jcenter() - android

This is a pretty straightforward question I would like to use the RealmRecyclerViewAdapter library on my project, but when I try to import it using mavenCentral() on my dependencies I got this error:
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find io.realm:android-adapters:3.1.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/io/realm/android-adapters/3.1.0/android-adapters-3.1.0.pom
- https://repo.maven.apache.org/maven2/io/realm/android-adapters/3.1.0/android-adapters-3.1.0.pom
Required by:
project :app
However if I just use jcenter() it works fine.
I'm changing it here at my module gradle file:
repositories{
jcenter()
//mavenCentral()
}
Is there any way to import this using mavenCentral() ?

I have a method which can help you get this library through jitpack.io repository.
First, add the repository in the repositories {} block like this:
repositories {
...
maven { url 'https://jitpack.io' }
}
Then add the dependency like this:
dependencies {
implementation 'com.github.realm:realm-android-adapters:v3.1.0'
}

No there is no way , Because its not even available on mavenCentral() .
As you can see here in the Note section
Note: this artifact is located at Realm repository (https://dl.bintray.com/realm/maven/)
So what you need to do is the following
maven {
url "https://dl.bintray.com/realm/maven/"
}
This way it should be accessable with no need to jcenter()

Related

502 google.bintray.com Bad Gateway

I have started to build Gradle in my android project but I had the following problem, does anyone know what happens?
I'm trying to get the Tflite dependency from Maven, never had a problem until today.
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve org.tensorflow:tensorflow-lite:+.
Required by:
project :app > project :tflite
> Failed to list versions for org.tensorflow:tensorflow-lite.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/org/tensorflow/tensorflow-lite/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/org/tensorflow/tensorflow-lite/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/org/tensorflow/tensorflow-lite/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
We experienced the same the last two days. It looks like it is working again.
after 3 days working on a such problem
I solved it by editing the project buildgradle
[appname]/build.gradle
as below
repositories {
google()
//commit this: maven
//maven()
// add this
mavenCentral()
}
allprojects {
repositories {
google()
//commit this: maven
//maven()
// add this
mavenCentral()
}
}
Bonus:
i had the same problem with the same library so maybe you need this setting on the same build.gradle file
Kotlin version:
ext.kotlin_version = '1.5.0'
dependencies:
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
For those who still have issues with JCenter / Bintray, you can switch to JitPack.
All you need to do is to search the GitHub project of your choice in https://jitpack.io then copy-paste the provided code in your build.gradle file.
Comment jcenter() and add mavenCentral()
repositories {
jcenter()
mavenCentral()
google()
}

Android Studio Gradle: Please remove usages of `jcenter()` Maven repository from your build scripts / JCenter is at end of life

In Android Studio 4.2 there is a warning:
buildscript {
ext.kotlin_version = '1.5.0'
repositories {
google()
//jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
//jcenter()
mavenCentral()
}
}
If I remove jcenter() then it can't find some dependencies of my app project:
> Could not find org.koin:koin-core:2.0.1.
Required by:
project :app
> Could not find org.koin:koin-androidx-scope:2.0.1.
Required by:
project :app
> Could not find org.koin:koin-androidx-viewmodel:2.0.1.
Required by:
project :app
> Could not find com.google.ads.mediation:chartboost:8.1.0.0.
Required by:
project :app
In replace of jcenter() I added mavenCentral()
Move mavenCentral() above jcenter().
do a clean/build on your project.
comment out jcenter()
By moving mavenCentral() above jcenter(), mavenCentral() now becomes the primary repository for all non Google artifacts. By doing a clean and build, all artifacts are now moved to mavenCentral().
I had to look this up and tried it. I went from all heck breaking loose after I removed jcenter() to being able to build my final project for school again.
For koin, change the group id from org.koin to io.insert-koin - the latter is published on maven central.
For chartboost, you can use the following repo:
maven {
url "https://dl.bintray.com/google/mobile-ads-adapters-android/"
}
Also note that there are newer versions such as koin 2.2.2 / 3.0.1 and chartboost 8.2.0.0. Older versions are likely not republished in non-jcenter repos.
mvnrepository is a good service for locating packages.
just commenting out jcenter() will help,
mavencentral() is already above jcenter.
Locate all build.gradle files in your project folder tree, open them and replace jcenter() by mavenCentral(). It works for me most of the time.
It is interesting that the AndroidStudio project template still adds the ref to jcenter() to gradle, but then as soon as the project attempts to build it requests that you remove it.
I just delete it from the gradle file and then it works.
So there are two issues here.
First, we need to move MavenCentral above jCenter in all projects
Second, Android build tools version need to upgraded to 4.2.0 and above. As Android internal build tool dependencies are going to jCenter
dependencies {
classpath("com.android.tools.build:gradle:4.2.0")
}
It should work
Hope this will help
Go to App/Gradle Scripts/build.gradle (Project:---)
Change the jcenter() on build script{} and in all project repositories.
and Sync now.
This is how it looklike before.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and after.
buildscript {
repositories {
google()
mavencentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
}
}
allprojects {
repositories {
google()
mavencentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This might help someone.
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
...
}
}
I used this to resolve:
> Could not find com.github.parse-community.Parse-SDK-Android:parse:1.26.0.
Required by:
project :app
I got the same error, while i was using the Android Studio Artic Fox Beta - 3 but after change Android Studio as Canary Build the error gone
The solution I did was to change build:gradle version:
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
The solution is simpe
just Locate build.gradle and replace jcenter() by mavenCentral().
good luck

Could not resolve all files for configuration ':react-native-image-picker:classpath'

I did not touch my project for a week, but when I came back and run the project on the android simulator I suddenly got this error
* What went wrong:
A problem occurred configuring project ':react-native-image-picker'.
> Could not resolve all files for configuration ':react-native-image-picker:classpath'.
> Could not find any matches for com.android.tools.build:gradle:2.2.+ as no versions of com.android.tools.build:gradle are available.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
https://jcenter.bintray.com/com/android/tools/build/gradle/
Required by:
project :react-native-image-picker
my build.gradle
buildscript {
repositories {
jcenter()
google()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
I have been searching on stackoverflow for a while and I could not find a solution. Any help is appreciated.
Move google() above jcenter() and do this for allProjects section too solved my same problem.
Check out this answer, it should help you solve your problem:
https://stackoverflow.com/a/53692168/3104599
Since links aren't enough, i'll copy-paste the answer here. Know that the answer isn't my own, i'm just quoting:
This is my fix, I did not fork repos just used this workaround: add
this to your build.gradle file, the sibling of settings.gradle file
subprojects { project ->
def name = project.name
if (name.contains('module name, e.g. react-native-blur')
|| name.contains('other module name, e.g. react-native-image-picker')) {
buildscript {
repositories {
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
} }
Check this: https://github.com/react-native-community/react-native-image-picker/issues/999#issuecomment-445465847
I had the same mistake, and I corrected it with this answer.
You just have to edit the 'classpath' of node_modules/react-native-image-picker/android/build.gradle with the same 'classpath' of your android/build.gradle.
I hope it will be useful.
Upgrade to the latest version 0.27.2, the problem is fixed there

Gradle error : Could not find com.android.tools.build:gradle:2.2.3

I'm trying to build my android project using gradle and circleCI, but I've got this error :
* What went wrong:
A problem occurred configuring root project '<myproject>'.
> 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:
:<myproject>:unspecified
Can someone explain me why I've got this problem please?
It seems the current versions of the Android Gradle plugin are not added to Maven Central, but they are present on jcenter. Add jcenter() to your list of repositories and Gradle should find version 2.2.3. On Maven Central the newest available version is 2.1.3: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.android.tools.build%22%20AND%20a%3A%22gradle%22. You can also complain to the authors that the current versions are missing on Maven Central.
Reading sembozdemir answer in this post I have resolved a similar problem adding jcenter() in build.gradle (module: cordovaLib)
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
After the recent update to Android Studio 3.0 Canary 1, I got the following error:
> Could not resolve all dependencies for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:3.0.0-alpha1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha1/gradle-3.0.0-alpha1.jar
Required by:
project :
Here is what I had to add (to the project-level build.gradle):
buildscript {
repositories {
maven {
url 'https://maven.google.com'
}
....
}
Found here: https://developer.android.com/studio/preview/features/new-android-plugin-migration.html
i had the same issue when i update my android studio to 3.0 then its solved by adding
buildscript {
repositories {
...
// You need to add the following repository to download the
// new plugin.
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
from https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#update_gradle
On my side I got the same issue because I used the wrong order of repositories.
google() should be added before jcenter()
buildscript {
repositories {
google()
jcenter()
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
}
}
Just change the mavenCentral() to jcenter()
Do you try it
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
flatDir {
dirs 'libs'
}
}
}
and
Build->Clear Project
Try this:
allprojects {
buildscript {
repositories {
maven {
url "https://dl.bintray.com/android/android-tools"
}
}
}
...
}
Updating CordovaLib -> build.gradle also worked for me, as above. I was looking at the root build.gradle initially which was correct and already included jcenter().
Only go to the following path and delete the caches folder completely then rebuild the project:
C:\Users\[Your User Name]\.gradle
Change the gradle version as same to android version like Right know we are using 2.3.2 of gradle
Add jcenter in your project gradle file and sync
The issue is caused by your type of internet connection which prevents or blocks Android Studio from downloading required files from jcenter, this should happen automatically when you build your solution. The solution to your problem is to connect to internet using your personal internet connection such as ADSL Router, rebuild the project and the download of necessary files will happen automatically.

Android Test Module (Gradle Plugin 1.3): dependencies from non-default maven repositories

I'm trying out APK Tests in Modules and went through the whole setup process. It seams that Gradle has problem finding dependencies of an app module if they are fetched from repositories other then jCenter.
One of the dependencies is MPAndroidChart located using jitpack:
repositories {
maven { url "https://jitpack.io" }
}
But plugin: 'com.android.test' seems to ignore this clause: it's not propagated from app module.
Reported error:
Error:A problem occurred configuring project ':test'.
> Could not resolve all dependencies for configuration ':test:_debugCompile'.
> Could not find com.github.PhilJay:MPAndroidChart:v2.0.9.
Searched in the following locations:
https://jcenter.bintray.com/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.pom
https://jcenter.bintray.com/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.jar
file:/Users/me/Library/Android/sdk/extras/android/m2repository/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.pom
file:/Users/me/Library/Android/sdk/extras/android/m2repository/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.jar
file:/Users/me/Library/Android/sdk/extras/google/m2repository/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.pom
file:/Users/me/Library/Android/sdk/extras/google/m2repository/com/github/PhilJay/MPAndroidChart/v2.0.9/MPAndroidChart-v2.0.9.jar
Required by:
company-android-app:test:unspecified > company-android-app:app:unspecified
Looks like the problem can be omitted by explicitly adding the repository to the test module:
repositories {
maven { url "https://jitpack.io" }
mavenCentral()
}
Tested with buildToolsVersion '23.0.0rc3' and classpath 'com.android.tools.build:gradle:1.3.0'

Categories

Resources