How to import eclipse library project from github to android studio project?
android, android-studio, eclipse
Solution
If you're importing a library as source code into a Gradle-based project, then at the moment there's no super-easy way to do it (sorry, it's on the to-do list, see https://code.google.com/p/android/issues/detail?id=62122) so you'll have to author your own build file for the library. Actually, it might be easier to use the New Module wizard to set up the build file and directory structure, then you can trim it down and copy the files over. This set of steps should get you up and running. It seems like a lot of steps but it should hopefully go pretty quick.
- From the File menu, choose New Module...
- From the wizard that comes up, choose Android Library
- From the next page of the wizard, give it the module name HoloCircularProgressBar, and uncheck the options for Create custom launcher icon and Create activity.
- Click Finish on the wizard.
It should add the new module to your project, so you'll end up with something like this:
- Delete everything inside the src/main folder.
- Now copy `AndroidManfiest.xml`, `ic_launcher-web.png`, `res`, and `src` from the HoloCircularProgressBar source into the `src/main` folder.
- Rename the `src` folder that you just copied into `src/main` to `java`.
- The New Module wizard left some things in the `build.gradle` file in your `HoloCircularProgresBar` module/directory (make sure you're editing that one, not the one for your main app module) we don't need. Remove the `dependencies` block and the `release` block.
At this point you should hopefully be able to build successfully. Now if you want to actually use the module:
- Go to File > Project Structure... > Modules > Your main module > Dependencies.
- Click on the + button to add a dependency, choose Module dependency, and select `HoloCircularProgressBar` from the list.
Now `import` statements and usages of the library should work, and you should be good to go.
Problem
I want to use HoloCircullarProgressBar as a library project in my android studio project. I tried to do it by copying into pre-created "library" folder in my project and then to add it to project in "Project Structure". But it's not working somehow. Could anyone give a very specific step-by-step tutorial on how to do that in android studio 0.3.6?