25

I don't understand how to add this library (https://github.com/owncloud/android-library) to my project in Android Studio.

Ryan M
  • 18,333
  • 31
  • 67
  • 74
Pinco Panco
  • 253
  • 1
  • 3
  • 7

2 Answers2

28

I have tried to import this library as a module but found error while importing: Error: Module name is not valid

So I tried to find a solution and here it is:

1. Download library from Github here.

enter image description here

2. Unzip library.

3. Start Android Studio.

4. Follow to File -> New -> Import Module .

enter image description here

5. Go to the path where your extracted library is located and select it.

enter image description here

6. Uncheck other modules and add 'androidlibrarymaster' described in below picture.

enter image description here

7. Add Gradle dependency and Its Done!

  compile project(':androidlibrarymaster');
SapuSeven
  • 1,473
  • 17
  • 30
AndiGeeky
  • 11,266
  • 6
  • 50
  • 66
12

Maybe try jitpack website to import this project with build.gradle file.

You have to add this snippet to your build.gradle file :

repositories {
    // ...
    maven { url "https://jitpack.io" }
}

And this statement to your dependencies :

compile 'com.github.owncloud:android-library:oc-android-library-0.9.7'
Pawel Urban
  • 1,316
  • 1
  • 12
  • 28
  • 2
    I have two build.gradle , which I must change? module or project – Pinco Panco Sep 16 '15 at 08:22
  • 1
    If you not renamed your module name it should be the one in `app` folder. – Pawel Urban Sep 16 '15 at 09:02
  • 1
    Can also add it to `allprojects` as shown here http://stackoverflow.com/questions/28779356/issue-resolving-gradle-dependency-in-android-studio/29565737#29565737 . just don't add it under `buildscript` – metrimer Sep 16 '15 at 14:13
  • Where do you find this name: "oc-android-library-0.9.7" on github? – Jomme Feb 20 '18 at 09:57
  • @Jomme In releases tab. The last part of Gradle dependency definition is version. In case of this library the versions are tagged as 'oc-android-librabry-0.9.x'. – Pawel Urban Feb 20 '18 at 10:00