Importing projects and libries into android studio for dummies?

105 Views Asked by At

I'm trying to import this as a library in a project I'm working on in Android Studio: https://github.com/d4rken/myolib

I cant workout exactly how to do it. even before I try to do this, I tried to open the project using new->Import project-> (selecting the settings.gradle). This then complained about not knowing about: classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

So I tried adding these manually using the advice on: Importing github projects as library to existing project Adding external library in Android studio

But its still complaining about no cached version for offline mode. If I do disable work in offline mode then, well it just sits there forever. I want to give it everything manually because in my experience disabling work in offine mode usually doesn't help.

I completely understand this isn't a new topic on Stackoverflow. The issue of how best to import libraries as .jar, .aar, .os etc. etc has been covered a few times. And yet most answers are subtly different and some work sometimes, others work other times.

Does anyone know of a detailed explanation about how I should achieve this ?

If anyone has been successful in importing this project and using its libraries I will be eternally grateful if you could tell me how you achieved such wizardry.

1

There are 1 best solutions below

0
Hobo Joe On

You import the library through your app's build.gradle file. An import section looks something like this:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile "com.android.support:support-v13:24.1.1"
}

So to import the library you just linked, you would simply add this line to your dependencies section, as per the readme:

compile 'eu.darken.myolib:myolib:0.0.4'