2

I am getting error while trying to implement a routing system into my map.

Here is the error : Failed to resolve: com.github.MKergall:osmbonuspack:6.7.0 Affected Modules: app

I have the following dependencies : implementation 'com.github.MKergall:osmbonuspack:6.7.0'. Tried the local one as well : ``` compile(name: 'osmbonuspack_v6.7.0', ext: 'aar') implementation 'org.osmdroid:osmdroid-android:6.1.10' implementation 'org.apache.commons:commons-lang3:3.12.0' implementation 'com.google.code.gson:gson:2.8.7' implementation 'com.squareup.okhttp3:okhttp:4.9.1'

I have this in my repositories :

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

How can I get this to work?

  • jcenter repository has been shut down. If the osmbonuspack was only available in jcenter then it is missing now. Try to download the mentioned source code of [GitHub project osmbonuspack](https://github.com/MKergall/osmbonuspack/releases/tag/6.7.0) in the desired version and build and install it yourself by executing `gradlew install`. Afterwards it will be available in the project you are trying to build. – Robert Jul 29 '21 at 03:38
  • Hi! Thanks for the suggesetion! it was avaiable through maven but I couldn't get that to work for some reason. I don't have too much experience how would I build and install it myself? – Andrew Wong Jul 29 '21 at 04:16
  • https://github.com/MKergall/osmbonuspack/wiki/HowToInclude Heres the guide I was following. I couldn't get either one to work. Maybe I'm doing something wrong? – Andrew Wong Jul 29 '21 at 04:20
  • The shown way via Jitpack looks quite good and should work. – Robert Jul 29 '21 at 09:33
  • I was able to get it to work via Jitpack, thanks so much! – Andrew Wong Jul 31 '21 at 23:16
  • I couldn't get the local install to work either. Building from source didn't sound easy but people on SO are complaining about the help by MKergall. After 20minutes on SO I drew the conclusions below. – John Aug 18 '21 at 21:43

1 Answers1

3

I had exactly these troubles and attempted to solve them using the newly refreshed and updated help wiki on https://github.com/MKergall/osmbonuspack/wiki/HowToInclude

What it doesn't tell you, possibly related to the newness of Android Studio Arctic Fox is https://stackoverflow.com/a/68012797

ie it is settings.gradle into which we must add our link to jitpack. This is contrary to advice to use project (root) level build.gradle, even the advice to add it under allprojects instead of buildscripts:

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

That caused: Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'

What eventually worked was:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url "https://jitpack.io" }
    }
}

in settings.gradle. Thanks to https://stackoverflow.com/a/68012797 for that. Most of it was already coded, I simply added maven { url "https://jitpack.io" }

John
  • 6,433
  • 7
  • 47
  • 82
  • but my case its working using this repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) in setting.gradle file other than both same – Venkatesh Jun 21 '23 at 04:46