androidandroid-studiorealmrealm-mobile-platform

Realm 5.15.0 and up to latest version (6.0.2), fails gradle sync


We are using Realm as our DB framework for Android. Current working version is 5.14.0. Yesterday we tried upgrading to 6.0.2 and gradle sync failed. I then pushed back the versions and saw that starting from 5.15.0 Realm causes gradle sync to fail with errors:

ERROR: Failed to resolve: io.realm:realm-android-library:5.15.0
ERROR: Failed to resolve: io.realm:realm-annotations:5.15.0

and a few other dependencies failing with the same exact error (but these might be affected by the first fail)

When I tried version 5.14 again, I got no errors and every thing was fine. I checked the gradle build log and I could see this line appearing MANY times:

WARN - un.AndroidRunConfigurationBase - Can't get application ID: Android module missing 

And a few like these:

WARN - roid.tools.ndk.GradleWorkspace - NDK support for project 'project.name' is disabled because the project doesn't contain any valid native configurations. 

and some:

INFO - ty.VersionCompatibilityChecker - Failed to find version reader for component 'android-gradle-experimental-plugin' 

one of these:

INFO - pl.ProjectRootManagerComponent - project roots have changed 

and eventually:

INFO - e.project.sync.GradleSyncState - Gradle sync failed (50 s 766 ms) 

It looks like the sync starts SYNC_TASK_CREATED, some libraries download and then SETUP_STARTED. It then fails almost right away.

Does anyone have any idea what is going on here and maybe possible reasons why this might fail? I can add any extra info you may need.

Thanks.

EDIT: I just ran ./gradlew check --stacktrace to get some more info on what is causing the issue and I get this:

Could not determine the dependencies of task ':app-name:testProdReleaseUnitTest'.
> Could not resolve all task dependencies for configuration ':app-name:prodReleaseUnitTestRuntimeClasspath'.
   > Could not find io.realm:realm-android-library:5.15.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
       - https://dl.google.com/dl/android/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
       - https://jitpack.io/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
       - https://jitpack.io/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
       - https://maven.fabric.io/public/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
       - https://maven.fabric.io/public/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
       - https://github.com/uPhyca/stetho-realm/raw/master/maven-repo/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
       - https://github.com/uPhyca/stetho-realm/raw/master/maven-repo/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
       - http://maven.batch.com/release/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
       - http://maven.batch.com/release/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
       - https://repo.maven.apache.org/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
       - https://repo.maven.apache.org/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar


Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find io.realm:realm-android-library:5.15.0.
Searched in the following locations:
  - https://dl.google.com/dl/android/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
  - https://dl.google.com/dl/android/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
  - https://jitpack.io/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
  - https://jitpack.io/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
  - https://maven.fabric.io/public/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
  - https://maven.fabric.io/public/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
  - https://github.com/uPhyca/stetho-realm/raw/master/maven-repo/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
  - https://github.com/uPhyca/stetho-realm/raw/master/maven-repo/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
  - http://maven.batch.com/release/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
  - http://maven.batch.com/release/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar
  - https://repo.maven.apache.org/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.pom
  - https://repo.maven.apache.org/maven2/io/realm/realm-android-library/5.15.0/realm-android-library-5.15.0.jar

Solution

  • Ok that was stupid. I really should give the error messages more credit...

    I added

    mavenLocal()
    jcenter()
    

    to

    allprojects {
        repositories {
    }
    

    in the root build.gradle file and now it found the Realm repo. Hehe. Thanks to all the viewers of this question.