How do you open an Android Studio project in Eclipse?
The new Android Studio allows for better Android development with better tools. I see a bunch of questions on how to transfer an eclipse project to android studio but what about the other way?
If you make an Android app in Android Studio, can you bring it back to Eclipse? If so, how?
This would be needed for specific eclipse plugins, such as the Blackberry Android plugin.
Thank you.
Solution 1:
You cannot import the project directly but it's not to hard to achieve it:
- Create a new Android empty project in eclipse
- Overwrite the fresh res/ folder and the AndroidManifest.xml file, with the ones from the Android Studio project
- Copy the content of the java/ folder from the Android Studio project (it should contain your package name folder structure, like com/example/app/, and the java files of course) in the Eclipse src folder
- Link your needed libraries if it's the case
Basically the Android application fundamental elements are the java files, the manifest file and the resources. From there you can build back a project in your favorite IDE
Solution 2:
It's not possible. We intend to add support for Gradle-based project in ADT but it's not currently possible.
Solution 3:
Step-by-Step process to import Android Studio Project into Eclipse...
-
Start new Android Project in eclipse using wizard and fill following details from app/build.gradle
ApplicationName and ProjectName : - You can find project name from .iml file in / folder PackageName : MinSDK, TargetSDK and CompileSDK
Click Next in the wizard and make sure that you have "unchecked" 'Create Activity' and "Create Custom Icon". Click Finish.
Open AndroidManifest.xml file in new created project. Copy "application", "uses-permission" etc tags as is from app/src/main/AndroidManifest.xml
Source Files : Replace all contents in AndroidStudio/app/src/main/java to Eclipse//src folder.
Resource Files : Replace all contents in AndroidStudio/app/src/main/res to Eclipse//res folder.
Library files : Copy all libs from AndroidStudio/app/libs to Eclipse//libs folder.
Dependency Library : Import and Add AppCompact as a dependent library using Properties->Android->Library->Add
Resolve any errors to build. Clean and Build again as a last step.
You may not be able to deploy it directly onto a phone but you can find .apk file generated in bin folder.
Solution 4:
UPDATE: see One Android project for Eclipse and Android Studio
Currently if you create Android project in Android Studio you will have hard times opening it in Eclipse. (However opening classic Android with added build.gradle
in Android Studio should be easier)
So you can open (as general project) and then convert some modules into Eclipse project, but still it will not be fully functional (but for a quick view inside may suffice)
from How to use Gradle to generate Eclipse and Intellij project files for Android projects
As answered in Issue 57668 by Android team (raised by @arcone)
Project Member #2 [email protected]
The eclipse plugin is not compatible with the android plugin.
You will not be able to import an Android gradle project into Eclipse using the default Gradle support in Eclipse.
To make it work in Eclipse we will have to change the Gradle plugin for Eclipse, the same way we are modifying the Gradle support in IntelliJ
That is Android team is working on gradle plugin for IntelliJ and gradle plugin for Eclipse needs to be updated too.
What is possible with Eclipse now is
THIS IS OUTDATED, see How to import Android Studio project in Eclipse?
.1. import the project as general project
.project
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OpenSpritz-Android</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
.2. Put 2 Eclipse . "dot" files into modules into /OpenSpritz-Android/app/src/main
and /OpenSpritz-Android/lib/src/main
.project
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OpenSpritz-Android-app</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
.classpath
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="java"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
.3. Import as Existing Android Code into Workspace
you can then browse code in familiar way, but even after that you won't be able to run with Eclipse ADT.
.4.
Now you can run build and tasks with gradle
CLI or Nodeclipse/Enide Gradle for Eclipse
(marketplace)
discuss at https://github.com/Nodeclipse/nodeclipse-1/issues/148
Also answered in Can't run imported gradle android project in Eclipse