0

I've spent hours trying to import/use a custom github repo for an android app and am having no luck. I'm new to Android Studio but can't seem to import the repo such that I can use its methods. I've tried a lot of recommendations from here and the wider web without success. Probably because the posts I have come across are 5+ years old...

  1. Have tried adding the following to to build.gradle (:app), but I get an error "Failed to resolve: com.github.pkleczko:CustomGauge:1.0.4":
implementation 'com.github.pkleczko:CustomGauge:1.0.4'
  1. Have tried adding the the following to the above, but this gives me the error "Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by build file 'app\build.gradle'":
repositories {
    mavenCentral()
}
  1. Have tried using New -> Import Module and New -> Project from Version Control per this, but these just opened the repo in a new window.

  2. Having CustomGuage as a dependency for my app module didn't seem to do anything either.

It shouldn't be this hard, should it?! Please help, what am I doing wrong?! Do I need to import the project and then refactor it for my needs rather than using it as a 'library'? Do I need to add an import statement to my java file?

Thank you!

1 Answers1

0

This is an old project. You can see his warehouse introduction. He uploaded it in jcenter. Of course, mavenCentral will not. this is repository -> pkleczko/CustomGauge

enter image description here

花未开
  • 159
  • 1
  • 6
  • Thanks, when I add the jcenter I get this error: Build was configured to prefer settings repositories over project repositories but repository 'BintrayJCenter' was added by build file 'app\build.gradle. Without the jcenter reference it builds fine, but I cannot use the repo in my app. Is there a way to get this working? – user1484397 Nov 21 '22 at 08:39
  • @用户1484397 I'm sorry, I can't do it, even if I add the jcenter warehouse, the parsing still fails. But this is just a simple custom View, you can try to learn to draw one yourself, very simple. – 花未开 Nov 21 '22 at 09:16