I have upgraded Android Studio from 4.1.3 to 4.2, using latest gradle and gradle plugin. Now references to using jcenter() in the build script are deprecated due to jcenter being end-of-lifed:
The suggestion is to "migrate" to mavenCentral(). I have various dependencies that are seemingly not on mavenCentral(), because gradle cannot find them, for example:
I Googled the artifact ("materialsearchview" in this case) and found it on the search platform "MVNrepository":
So here is what I have tried (all unsuccessful) to put a reference into my build script to have gradle find this artifact:
I added a reference to the mvnrepository to my project level build.gradle file (which I didn't expect to work given that mvnrepository is a search mechanism) highlighted in the red box in the pic, i.e.:
maven { url 'https://mvnrepository.com/artifact/' }
I added a reference to the repository identified in the blue box at the bottom where mvnrepository says the artifact is located, i.e.
maven {url 'https://repo.spring.io/plugins-release/'}
This generated a slightly different error:
Could not HEAD 'https://repo.spring.io/plugins-release/com/miguelcatalan/materialsearchview/1.4.0/materialsearchview-1.4.0.pom'. Received status code 401 from server: Unauthorized
I found the .aar file for this dependency, added it to my 'libs' directory and updated my app module level build.gradle file like this:
implementation fileTree(include: ['.jar','.aar'], dir: 'libs')
I did an 'invalidate caches and restart' at this point, thinking AS needed to index the newly added .aar file before gradle would recognize it. No joy.
I specifically added the .aar file to the libs directory, then added a reference to it in the app module build.gradle:
implementation(name:'materialsearchview-1.4.0', ext:'aar')
then did another invalidate cache/restart. No joy.
So I guess I have three questions:
Once I find a reference to an artiface in mvnrepository, is there a proper way to reference it in my gradle script so that the build system can reconcile what it needs?
What other ways are there to find what other repositories that gradle CAN address to see if the item is there?
Why is using the .aar file in the libs directory as I am doing it failing? Why can't Gradle see it there?
Thanks!