Second maven repository in gradle on an Android Project - android

this is the way I added facebook repository in order to use FacebookSDK on an gradle-based android project
repositories {
mavenCentral()
mavenLocal()
maven {
url "http://mente.github.io/facebook-api-android-aar"
}
}
Now I have to add a new repository for the umano sliding menu (https://github.com/umano/AndroidSlidingUpPanel).
I've tried something like this (but it obviously doesn't work):
repositories {
mavenCentral()
mavenLocal()
maven {
url "http://mente.github.io/facebook-api-android-aar", "https://bitbucket.org/luciofm/m2repository/raw/master/"
}
}

You need to add it separately:
maven {
url "http://mente.github.io/facebook-api-android-aar"
}
maven {
url "https://bitbucket.org/luciofm/m2repository/raw/master/"
}

Related

Android gradle problem while build with using MPAndroidChart

I am trying to use MPAndroidChart, but there is occuring build gradle problem.
I reference the github document below.
https://github.com/PhilJay/MPAndroidChart
I follow the 'Gradle Setup'
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
This is how I put the codes
and when I started to build it the error code is
Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'app\build.gradle'
Did I put the build code in the wrong way? or did I missed some important settings?
Probably, you need to append the entry, maven { ... } to the dependencyResolutionManagement.repositories clause in settings.gradle.
app/build.gradle
// repositories {
// maven { url 'https://jitpack.io' }
// }
settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}

What is the order of searching maven repositories in Android

I had a problem writing android projects,I have a build.grade file as follows. When I build the project, I pull the project dependencies in the order A->B->C->mavenLocal? Or mavenLocal -> C->B->A? Or any other search order? Is it that once a Maven pull is successful there is no further search?Please help me~
allprojects {
repositories {
maven { url A }
maven { url B }
maven { url C }
mavenLocal()
}
}

Automatically add repositories from dependencies

I have a library with a dependency that requires a custom repo
dependencies {
implementation 'com.chartboost:chartboost-sdk:8.1.0'
}
repositories {
mavenCentral()
maven { url "https://chartboostmobile.bintray.com/Chartboost" }
}
This works fine, but it forces me to add maven { url "https://chartboostmobile.bintray.com/Chartboost" } to every project that uses that library. I would like to know, is there a way to modify my own library so I wouldn't need to add the custom maven repo for that dependency? Something that would add all the repos in the library to the project. I tried switching implementation with api to no avail
You can put your repository into [USER_HOME]/gradle/init.gradle file:
allprojects {
repositories {
mavenCentral()
maven { url "https://chartboostmobile.bintray.com/Chartboost" }
}
}
then they are will be applied to all projects

How to extend cordova build.gradle to change repositories

Problem
Due to a problem with jcenter repository I need to instruct gradle to use use maven repository. I could fix the problem changing the file build.gradle:
Original:
//...
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
//...
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
//...
Modified:
//...
buildscript {
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
//...
}
allprojects {
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
//...
Since this file is not versioned, and per Cordova documentation, the way to extend build.gradle is to create a build-extras.gradle file, I've done so and have tried to add the same content I've modified in the build.gradle file, like:
build-extras.gradle
buildscript {
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
//...
}
allprojects {
repositories {
mavenCentral()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
Question
To sum up, changing the build.gradle file works but placing the same diffed content in build-extras.gradle it does not. Is there something that I'm missing?
Remove platforms and plugins folders (lets do everything from scrach so it's cleaner).
Do ionic cordova platform add android
Do cordova plugin add cordova-android-play-services-gradle-release --variable PLAY_SERVICES_VERSION=15.0.0 --fetch
Now finally you can do ionic cordova run android or ionic cordova build android

android studio appcompat v7:26

I have a problem with android studio.
I will create a new project (without changing the parameter, just the next one), then I encounter these problems.
Go to your Project level build.gradle and add this after that sync
allprojects {
repositories {
jcenter()
google()
}
}
From version 26.0.0 of support libraries make sure that the
repositories section includes a maven section with the
"https://maven.google.com" endpoint.
Read Document
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
For Gradle build tools plugin version 3.0.0, you can use google()
repository:
Read Document
allprojects {
repositories {
jcenter()
google()
}
}

Categories

Resources