0

I want to add a library in Android Studio as dependency to use it in my project.

I tried both adding the dependency via Module Settings menu and via direct input in build.gradle-file of the Module (s. snapshot).

I also tried entering mavenCentral()-repository (snapshot) as described here.

Building/synching the project with gradle is successful but org.apache.olingo lib never appears in log nor is added to my lib folder (or external libraries).
Of course I already tried refreshing the project tree-view (w/o success).

Why isn't the library downloaded (since I can search for the lib in the dependencies-add menu the internet access should be no barrier) and how could I fix this issue?

(As you may have realized, I'm a newbie in this environment - any hint might help)

ExpressEdU
  • 11
  • 5
  • Did you try to import a class from the library? – Gabriele Mariotti Sep 07 '15 at 22:53
  • @GabrieleMariotti : Yes, I did (see [this snapshot](http://i.stack.imgur.com/wamf6.png)). I also tried adding the .jars manually by downloading them and adding to dependencies (see [here](http://i.stack.imgur.com/wUdwZ.png)) - this triggers a _Error:Gradle: duplicate files during packaging of APK_ and a > _Exec. failed for task ':app:packageDebug'._ > Duplicate files copied in APK META-INF/DEPENDENCIES > File 1: ...\app\libs\org.apache.olingo-olingo-odata2-core-2.0.4.jar > File 2: ...\app\libs\org.apache.olingo-olingo-odata2-api-2.0.4.jar . Do you have any suggestions what to do next? – ExpressEdU Sep 08 '15 at 19:55
  • In the android block in the build.gradle add: packagingOptions { exclude 'META-INF/DEPENDENCIES'} – Gabriele Mariotti Sep 08 '15 at 20:18
  • 1
    _Thanks to your hint_, I'm now able to use the .jar-files in my Project (i also added excludes for "META-INF/LICENSE" and "META-INF/NOTICE")! This seems to be a good workaround for me in short term. Anyway, I would also like to know _which detail prevents me from loading the lib in my project automatically from maven repository_. I would be thrilled if anyone could identify and fix the original issue. – ExpressEdU Sep 08 '15 at 21:57
  • Look very carefully what you type into `dependencies{}` block in your app's gradle file. One typo ruins everything. Double check. Also, take a look at `Messages` -> `Show console output` to see what exactly is happening wrong. – Sevastyan Savanyuk Feb 07 '18 at 13:38

0 Answers0