Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include dependency from Maven local repository on Android Studio Gradle

Tags:

android

maven

I think I'm stupid or I'm missing something -hope the latter- but I can't properly import a dependency.

I have the repository in ~/.m2/repository and inside the directory I can see the deploy.

The maven setting.xml has the

<localRepository>${user.home}/.m2/repository</localRepository>

Here is the gradle file:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':lib_facebook')
compile project(':lib_dslrdashboard')
apt "org.androidannotations:androidannotations:3.2"
compile 'org.androidannotations:androidannotations-api:3.2'
compile 'de.livereach:rpc-objects-android:1.0.0'//THIS IS THE LOCAL DEPENDENCY
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'org.slf4j:slf4j-android:1.6.1-RC1'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'com.fasterxml.jackson.core:jackson-databind:2.3.2'
compile 'de.keyboardsurfer.android.widget:crouton:1.8.5@aar'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.github.castorflex.smoothprogressbar:library:1.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.2.3@aar') {
    transitive = true;
}
compile('com.twitter.sdk.android:twitter:1.4.0@aar') {
    transitive = true;
}

}

I'm on Mac OSx 10.10

Thanks in advance!

like image 311
Julio_oa Avatar asked Jul 21 '15 20:07

Julio_oa


People also ask

Can Gradle use Maven dependency?

Gradle can consume dependencies available in the local Maven repository.

How do I add a dependency in Gradle?

To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build.gradle file.


1 Answers

Gradle doesn't look at your Maven local repository by default. You need to explicitly ask it to:

allprojects {
    repositories {
        jcenter()
        mavenLocal()    // add this line
    }
}

Gradle DSL Docs for mavenLocal(): docs.gradle.org/…

like image 179
Barend Avatar answered Oct 17 '22 00:10

Barend