Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDK] Could not resolve all dependencies for org.matrix.android:matrix-android-sdk2 #4271

Closed
cryptodev100 opened this issue Oct 19, 2021 · 3 comments

Comments

@cryptodev100
Copy link

Description

Hi,

I tried to integrate the matrix-android-sdk into an existing Android-app by adding the following line to my app-module's build.gradle.kts:

implementation("org.matrix.android:matrix-android-sdk2:1.3.2")

However, my build fails with the following output:

Could not resolve all task dependencies
Could not find com.github.Zhuinden:realm-monarchy:0.7.1.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/github/Zhuinden/realm-monarchy/0.7.1/realm-monarchy-0.7.1.pom
- https://dl.google.com/dl/android/maven2/com/github/Zhuinden/realm-monarchy/0.7.1/realm-monarchy-0.7.1.pom
- https://jcenter.bintray.com/com/github/Zhuinden/realm-monarchy/0.7.1/realm-monarchy-0.7.1.pom
Required by:
project :app > org.matrix.android:matrix-android-sdk2:1.3.2
Could not find org.matrix.gitlab.matrix-org:olm:3.2.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/matrix/gitlab/matrix-org/olm/3.2.4/olm-3.2.4.pom
- https://dl.google.com/dl/android/maven2/org/matrix/gitlab/matrix-org/olm/3.2.4/olm-3.2.4.pom
- https://jcenter.bintray.com/org/matrix/gitlab/matrix-org/olm/3.2.4/olm-3.2.4.pom
Required by:
project :app > org.matrix.android:matrix-android-sdk2:1.3.2

Possible solution:

As we can see, the missing dependencies are com.github.Zhuinden:realm-monarchy:0.7.1 and org.matrix.android:matrix-android-sdk2:1.3.2.
Both of these missing dependencies are declared in the sdk's build.gradle as follows: https://github.com/matrix-org/matrix-android-sdk2/blob/develop/matrix-sdk-android/build.gradle

So my question is: Am I missing to declare some repositories in my top-level build.gradle?
Where are we supposed to find those Maven-dependencies?

@cryptodev100
Copy link
Author

cryptodev100 commented Oct 19, 2021

I was able to resolve the issue by adding the following to my top-level build.gradle.kts:

allprojects {
    repositories {
        maven {
            url = uri("https://jitpack.io")
            content {
                // Use this repo only for olm library
                includeGroupByRegex ("org\\.matrix\\.gitlab\\.matrix-org")
                // And also for FilePicker
                includeGroupByRegex ("com\\.github\\.jaiselrahman")
                // And monarchy
                includeGroupByRegex ("com\\.github\\.Zhuinden")
                // And ucrop
                includeGroupByRegex ("com\\.github\\.yalantis")
                // JsonViewer
                includeGroupByRegex ("com\\.github\\.BillCarsonFr")
                // PhotoView
                includeGroupByRegex ("com\\.github\\.chrisbanes")
                // PFLockScreen-Android
                includeGroupByRegex ("com\\.github\\.vector-im")
                // DraggableView
                includeGroupByRegex ("com\\.github\\.hyuwah")

                // Chat effects
                includeGroupByRegex ("com\\.github\\.jetradarmobile")
                includeGroupByRegex ("nl\\.dionsegijn")

                // Voice RecordView
                includeGroupByRegex ("com\\.github\\.Armen101")
            }
        }
        // other repositories come here
   }
}

I took this from the top-level build.gradle in this monorepo: https://github.com/vector-im/element-android/blob/develop/build.gradle
Nevertheless, I think that this should be added to the documentation for all sdk-only-consumers.

@bmarty
Copy link
Member

bmarty commented Oct 19, 2021

This should not be necessary, we do not do that for instance in the sample app

Sometimes we have issue to get org.matrix.gitlab.matrix-org:olm, this is maybe the root cause. We are working to get ride of this issue, and this is tracked by https://gitlab.matrix.org/matrix-org/olm/-/issues/5

@ouchadam
Copy link
Contributor

ouchadam commented Oct 25, 2021

glad to hear your issue is resolved, it sounds like you were missing the jitpack repository

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants