bz3mxg
Last Updated: February 25, 2016
·
825
· aferiat
Johnnyb012

how to mount an android studio project on eclipse

Pre-requisites:

i- Eclipse with ADT plugin installed. Make sure you have the following packages (Android SDK Manager) also installed:

Android Support Library

Android Support Repository

Android SDK Tools

Android SDK Build-tools

Android SDK Platform-tools

Google USB Driver

ii- Your ANDROID_SDK env variable must be set

Steps:

1- Create the eclipse artifacts by running

gradle eclipse

By default, this will create an eclipse project named 'app'. You can rename the eclipse project file into something else if you want to.

2- Mount your eclipse project into Eclipse. (Import Existing Project into Workspace)

3- Run the following:

gradle -q copyEclipseJarDependencies

This will add all android project dependencies (defined in gradle) into your libs directory: /libs

4- Android studio reads the manifest file and the resources files from a different folder than where eclipse would look for it. You need to create symb link.

mklink AndroidManifest.xml \app\src\main\AndroidManifest.xml

mklink /D res \app\src\main\res

5- Mount the android dependencies projects into eclipse. The android dependency is handled by gradle. In eclipse, we need to let ADT know about these dependencies. It's the case of Projects android-support-v7-appcompat and eazegraph.

5-1 android-support-v7-appcompat This project ships as an eclipse project from google. So all you need is to import as such. Make sure to mark it as library. To do so, right click on the project, properties, then pick Android, then check the 'is Library' option. Build it.

5-2 eazegraph This src code will be available under /libs Import it as an existing Android code into Workspace. This will create the eazegraph-1.2.2 project Same as in 5-1, make sure to mark it as a library and then build it.

6- Define the above android dependencies as such for eclipse In order to do that, simply right click on the android project and go to properties, android, then add both projects.

IMPORTANT: A bug in the ADT eclipse plug-in requires that the project itself and its android dependencies should be in the same drive (same workspace to be completely on the safe side). Failing to do so, you will see a little red cross (as oppposed to a green check mark), after re-opening the android menu, in the dependency list.

7- You should be able to build and run your project

Say Thanks
Respond

1 Response
Add your response

21091
Mahface

Great writeup, very useful! Keep em coming!

over 1 year ago ·