9

I'm not very familiar with Gradle, but from what I understand you're supposed to be able to pull libraries straight from the internet? I've followed the project's directions, but got an error

Does AIDE not support remote maven repos? I confirmed that the library in question does exist on the jcenter website. I'm not sure how to make a local maven repository. I tried to download the relevant files from jcenter and put them in .../maven-repo/com/melnykov/floatingactionbutton/1.0.3 and point AIDE to .../maven-repo in the settings, but that did nothing.

ABP
  • 115
  • 1
  • 1
  • 8
  • Which are the relevant files you downloaded? The project source? The aar? – Mike M. Sep 24 '14 at 02:58
  • @MikeM. Yeah all of the above. I picked up everything. – ABP Sep 24 '14 at 03:13
  • Ok, if you've got the `/library` project folder, I think we can get ya working. You might need to download an additional support package. First thing, though: in AIDE, navigate to the `/library` folder, long-press it, and make sure "Add library to project" is an option. – Mike M. Sep 24 '14 at 03:29
  • @MikeM. You mean the library folder that's in the library source tree? Sorry, I thought you meant the -sources.jar file from jcenter that as far as I can tell just contains the manifest. The actual project is packaged in an aar file. I forgot to mention, but I actually have tried grabbing the source from github and doing the longoress thing, but the library still doesn't show up in the project properties or have any other effect. – ABP Sep 24 '14 at 04:03
  • Actually, before I noticed you'd said you'd downloaded from maven, I cloned the github repo and got that working pretty easily. I can post that method, if you like. – Mike M. Sep 24 '14 at 04:07
  • @MikeM. Yeah, I'd appreciate it. – ABP Sep 24 '14 at 04:12

1 Answers1

8

Note: AIDE now supports remote maven repositories, so this answer is obsolete unless you are using an older version.

AIDE does not support remote maven repos. The only way you can make maven repositories work within the app is create a local maven repo. This is as simple as copying a folder from PC to Device if the library you need is in /sdk-path/extras/ (Android and Google libs are there), but a bit more difficult if it is not:

I had success manually creating a maven repository using these steps:

  1. Download the following files from the right subdir on jcenter.bintray.com:
    • maven-metadata.xml
    • artifact-name-version.aar
    • artifact-name-version.pom
  2. Create a new folder on your device and call it m2repository
  3. Open maven-metadata.xml and remember the groupId, artifactId and version
  4. Create folders for every component of the groupId inside your m2repository (e.g. groupId = com.github.test, folder structure: com/github/test)
  5. Inside of the folder structure (e.g. folder test) , create a folder named after the artifactId from the maven-metadata.xml (often it's library)
  6. Move the downloaded maven-metadata.xml into the newly created artifactId folder
  7. Create a new folder named after the version from the metadata file (e.g. 1.0.0)
  8. Move the pom and aar files into the newly created folder.

Now, you have to link the maven directory with AIDE:

  • Open AIDE
  • Go to Menu>More>Settings>Build and Run
  • Tap Local Maven Repositories
  • Add the path to your m2repository folder (so the path ends with /m2repository)
  • Close settings
  • Wait until AIDE rebuilds the project

If you have a code-only library (no resources), chances are there is a .jar file which you could easily just copy into the libs/ folder of your project. In this case make sure you have the following line added to the dependencies section of your build.gradle:

compile fileTree(dir: 'libs', include: ['*.jar'])

Please note all this only applies if your project uses the new gradle-based project structure.

Jonas Czech
  • 12,018
  • 6
  • 44
  • 65
FD_
  • 12,947
  • 4
  • 35
  • 62