Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import eclipse library project from github to android studio project?

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?

enter image description here

like image 937
user1685095 Avatar asked Dec 01 '13 08:12

user1685095


People also ask

How to import Eclipse project into Android Studio?

Now, open the downloaded project in Android Studio by following the below instructions. Import eclipse project modules into Android Studio. Select File -> New -> Import Module Image title Next, select the path of the eclipse project and import the modules.

How do I add a library to an android project?

Select ‘File > Project structure’ from the Android Studio toolbar. In the left-hand menu, select the module where you want to use this library. Select the ‘Dependencies’ tab. Select the little ‘+’ icon, followed by ‘Module dependency.’ Select your library module, then click ‘OK.’ Exit the ‘Project structure’ window.

How do I import Eclipse ADT files into Android Studio?

From the Android Studio menu click File > New > Import Module. Select the Eclipse ADT project folder with the AndroidManifest.xml file and click Ok. Modify the module name if desired, and click Next. The import process prompts you to migrate any library and project dependencies to Android Studio,...

How do I import a GitHub repository into Android Studio?

Solution 1 Install git for Windows. It can be downloaded for free from git-scm.com. ... 2 Link git executable to Android Studio. Open Android Studio and got to Settings. ... 3 Get the Path to your Repository from Github. Go to the GitHub page and get the HTTPs path to your repository. 4 Import the Git project to Android Studio. ...


Video Answer


1 Answers

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.

  1. From the File menu, choose New Module...
  2. From the wizard that comes up, choose Android Library
  3. 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.
  4. Click Finish on the wizard.

It should add the new module to your project, so you'll end up with something like this:

Project view after adding new empty library

  1. Delete everything inside the src/main folder.
  2. Now copy AndroidManfiest.xml, ic_launcher-web.png, res, and src from the HoloCircularProgressBar source into the src/main folder.
  3. Rename the src folder that you just copied into src/main to java.
  4. 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:

  1. Go to File > Project Structure... > Modules > Your main module > Dependencies.
  2. 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.

like image 187
Scott Barta Avatar answered Oct 19 '22 05:10

Scott Barta