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?
新的Android Studio允许更好的Android开发和更好的工具。我看到了很多关于如何将eclipse项目转移到android studio的问题,但另一方面呢?
If you make an Android app in Android Studio, can you bring it back to Eclipse? If so, how?
如果你在Android Studio中开发一个Android应用,你能把它带回Eclipse吗?如果是这样,如何?
This would be needed for specific eclipse plugins, such as the Blackberry Android plugin.
这对于特定的eclipse插件(如黑莓Android插件)来说是必需的。
Thank you.
谢谢你!
11 个解决方案
#1
41
It's not possible. We intend to add support for Gradle-based project in ADT but it's not currently possible.
这是不可能的。我们打算在ADT中增加对基于等级的项目的支持,但目前还不可能。
#2
69
You cannot import the project directly but it's not to hard to achieve it:
你不能直接导入项目,但实现它并不难:
- Create a new Android empty project in eclipse
- 在eclipse中创建一个新的Android空项目
- Overwrite the fresh res/ folder and the AndroidManifest.xml file, with the ones from the Android Studio project
- 覆盖新的res/文件夹和AndroidManifest。xml文件,以及来自Android Studio项目的文件
- 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
- 从Android Studio项目中复制java/文件夹的内容(它应该包含您的包名文件夹结构,比如com/ example/app/0,当然还有java文件)到Eclipse src文件夹中
- 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
基本上,Android应用程序的基本元素是java文件、清单文件和资源。从那里,您可以在您喜欢的IDE中构建一个项目
#3
3
Step-by-Step process to import Android Studio Project into Eclipse...
逐步将Android Studio项目导入Eclipse的过程……
-
Start new Android Project in eclipse using wizard and fill following details from app/build.gradle
使用向导在eclipse中启动新的Android项目,并从app/build.gradle中填写以下细节
ApplicationName and ProjectName : - You can find project name from .iml file in / folder PackageName : MinSDK, TargetSDK and CompileSDK
你可以在/文件夹PackageName中找到项目名:MinSDK、TargetSDK和compile esdk
-
Click Next in the wizard and make sure that you have "unchecked" 'Create Activity' and "Create Custom Icon". Click Finish.
在向导中单击Next,确保您有“未检查”的“创建活动”和“创建自定义图标”。单击Finish。
-
Open AndroidManifest.xml file in new created project. Copy "application", "uses-permission" etc tags as is from app/src/main/AndroidManifest.xml
AndroidManifest开放。新创建的项目中的xml文件。从app/src/main/AndroidManifest.xml中复制“应用程序”、“使用许可”等标签。
-
Source Files : Replace all contents in AndroidStudio/app/src/main/java to Eclipse//src folder.
源文件:将AndroidStudio/app/src/main/java的所有内容替换为Eclipse//src文件夹。
-
Resource Files : Replace all contents in AndroidStudio/app/src/main/res to Eclipse//res folder.
资源文件:将AndroidStudio/app/src/main/res中的所有内容替换为Eclipse/ res文件夹。
-
Library files : Copy all libs from AndroidStudio/app/libs to Eclipse//libs folder.
库文件:将所有的libs从AndroidStudio/app/libs复制到Eclipse//libs文件夹。
-
Dependency Library : Import and Add AppCompact as a dependent library using Properties->Android->Library->Add
依赖库:使用属性(>Android->Library->Add)作为依赖库导入和添加AppCompact
-
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.
您可能无法将其直接部署到手机上,但您可以找到在bin文件夹中生成的.apk文件。
#4
2
UPDATE: see One Android project for Eclipse and Android Studio
更新:在Eclipse和Android Studio中看到一个Android项目。
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)
目前,如果您在Android Studio中创建Android项目,您将很难在Eclipse中打开它。(不过,打开经典的Android,添加构建。Android Studio中的等级应该更容易)
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)
因此,您可以打开(作为通用项目),然后将一些模块转换为Eclipse项目,但它仍然不能完全发挥功能(但是对于内部的快速视图可能就足够了)
from How to use Gradle to generate Eclipse and Intellij project files for Android projects
从如何使用Gradle为Android项目生成Eclipse和Intellij项目文件
As answered in Issue 57668 by Android team (raised by @arcone)
如Android team 57668期的回答(@arcone提出)
Project Member #2 x...@android.com
项目成员# 2 x…@android.com
The eclipse plugin is not compatible with the android plugin.
eclipse插件与android插件不兼容。
You will not be able to import an Android gradle project into Eclipse using the default Gradle support in Eclipse.
您将无法使用Eclipse中的默认等级支持将Android gradle项目导入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
要使它在Eclipse中工作,我们必须改变Eclipse的Gradle插件,就像我们修改IntelliJ中的Gradle支持一样
That is Android team is working on gradle plugin for IntelliJ and gradle plugin for Eclipse needs to be updated too.
Android团队正在开发IntelliJ的gradle插件,Eclipse的gradle插件也需要更新。
What is possible with Eclipse now is
现在Eclipse有什么可能呢?
THIS IS OUTDATED, see How to import Android Studio project in Eclipse?
这已经过时了,看看如何在Eclipse中导入Android Studio项目?
.1. import the project as general project
1。。作为一般项目导入项目
.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
。2。把2 Eclipse。“点”文件到模块中/OpenSpritz-Android/app/src/main和/OpenSpritz-Android/lib/src/main。
.project
. 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
. 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
。3。将现有的Android代码导入到工作区
you can then browse code in familiar way, but even after that you won't be able to run with Eclipse ADT.
然后,您可以以熟悉的方式浏览代码,但即使这样,您也无法使用Eclipse ADT运行代码。
.4.
。4。
Now you can run build and tasks with gradle
CLI or Nodeclipse/Enide Gradle for Eclipse (marketplace)
现在,您可以使用Eclipse(市场)的CLI或Nodeclipse/Enide gradle运行构建和任务
discuss at https://github.com/Nodeclipse/nodeclipse-1/issues/148
讨论https://github.com/Nodeclipse/nodeclipse-1/issues/148
Also answered in Can't run imported gradle android project in Eclipse
也回答了在Eclipse中不能运行导入的gradle android项目
#5
0
Import project then Properties > java build path > source tab....remove path to src....add path to java folder in the source code using add folde rbutton... then build your project as usual
导入项目然后属性> java构建路径>源标签....删除路径src ....使用add folde rbutton向源代码中的java文件夹添加路径…然后像往常一样构建项目
#6
0
I think its not possible to import an android studio project to eclipse, without very much hand work.
我认为,如果没有大量的手工工作,将android studio项目导入eclipse是不可能的。
#7
0
I really miss the automatic build feature in Eclipse but also hate the speed and bugs in Eclipse for Mac. It would be nice to have the best of both worlds. The project layout in Eclipse and Android Studio has a lot in difference and I guess it would be very difficult if not impossible to change the default layout. Therefore, I tried to create an empty Android project in Eclipse. Then I deleted the physical folders and files and created linked resources to reference those in the Android Studio project and voila! It works.
我真的很怀念Eclipse中的自动构建功能,但我也讨厌Mac在Eclipse中的速度和bug。Eclipse和Android Studio中的项目布局有很多不同之处,我想要改变默认布局是非常困难的。因此,我尝试在Eclipse中创建一个空的Android项目。然后,我删除了物理文件夹和文件,并创建了链接资源,以引用Android Studio项目中的那些文件。它的工作原理。
Here is my resource mapping:
这是我的资源映射:
AS-Project/app/src/main/AndroidManifest.xml -> Eclipse-Project/AndroidManifest.xml
AS-Project/app/src/main/res -> Eclipse-Project/res
AS-Project/app/src/main/assets -> Eclipse-Project/assets
AS-Project/app/src/main/java -> Eclipse-Project/src
AS-Project/app/libs -> Eclipse-Project/libs-as
Linked folder doesn't quite work for the "libs" folder. So I mapped it to a folder called "libs-as" and manually added the JARs to project build path. In the worst case I guess you could maintain two separate libs folders.
链接文件夹对“libs”文件夹不太适用。因此我将它映射到一个名为“libas”的文件夹,并将jar手动添加到项目构建路径中。在最坏的情况下,我猜您可以维护两个独立的libs文件夹。
P.S. It would be a good idea to put two projects side by side and use location variables to reference relative paths (e.g. ${PARENT-1-PROJECT_LOC})
将两个项目并排放在一起,并使用位置变量引用相对路径(例如${parent -1 project_loc})是个好主意。
#8
0
The published answer worked for me, but only after some mis-steps due to my inexperience with these IDEs. For any other beginner be careful with these ...
公开的答案对我起了作用,但只是在由于我对这些ide缺乏经验而出现了一些失误之后。对于其他初学者,要小心这些……
- use the same minimum, target and build SDKs
- 使用相同的最小值、目标和构建SDKs
- use the exact same project name, and watch the sequence of project directories based on the package name, for the correct location of the .java file[s]
- 使用完全相同的项目名称,并根据包名查看项目目录的顺序,以获得.java文件的正确位置。
- for the /res folder copy over missing directories
- 对于/res文件夹,在丢失的目录上复制
- edit [i used NotePad] all matching xml files, carefully choosing the correct mix of entries, some from each
- 编辑[我使用记事本]所有匹配的xml文件,仔细选择正确的条目组合,每个条目中有一些
After this there may still be some errors to contend with, but with some persistence you should be able to correct them.
在此之后,可能仍然有一些错误需要处理,但是通过某种持久性,您应该能够纠正它们。
#9
0
I just published a project that requires to work for Android Studio or Eclipse users. It's basically an Android Studio project, but I provided a gradle build file that developers can use to convert it to Eclipse.
我刚刚发布了一个需要为Android Studio或Eclipse用户工作的项目。它基本上是一个Android Studio项目,但我提供了一个gradle构建文件,开发者可以用它将其转换为Eclipse。
Basically developers would have to run the following command to convert the project to Eclipse:
基本上,开发人员必须运行以下命令才能将项目转换为Eclipse:
gradle -b eclipse.gradle eclipse
Here are the contents of eclipse.gradle:
这是日食的内容。
apply plugin: 'java'
apply plugin: 'eclipse'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
// Add the natures and build commands to the project
eclipse.project {
natures 'com.android.ide.eclipse.adt.AndroidNature'
natures 'org.eclipse.jdt.core.javanature'
buildCommands.clear();
buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder'
buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder'
buildCommand 'org.eclipse.jdt.core.javabuilder'
buildCommand 'com.android.ide.eclipse.adt.ApkBuilder'
}
// The source code is in the java folder
sourceSets.main.java.srcDirs 'java'
dependencies {
// declare your dependencies here
}
Hope this helps
希望这有助于
Adding step-by-step procedure. 1. Install gradle. Note that if you have Android Studio you already have gradle. 2. Create an eclipse.gradle file in the root folder of your Android Studio project and copy the contents of the eclipse.gradle mentioned above. 3. Open a command prompt or terminal and run gradle -b eclipse.gradle 4. Try to open in Eclipse
添加循序渐进的过程。1。安装它。注意,如果你有Android Studio,你已经有了gradle。2。创建一个eclipse。在Android Studio项目的根文件夹中复制渐变文件并复制eclipse的内容。gradle上面提到的。3所示。打开命令提示符或终端,运行level -b eclipse。gradle 4。尝试在Eclipse中打开
#10
0
It's quite simple if you know the trick.
如果你知道诀窍的话,这很简单。
-
Replace the eclipse project Res folder with Android studio project's res folder.
将eclipse项目Res文件夹替换为Android studio项目的Res文件夹。
-
Go inside java folder and copy all folders and paste inside src folder of eclipse project.
进入java文件夹,复制所有文件夹,粘贴到eclipse项目的src文件夹中。
-
Open Android manifest of android studio project, copy all of the content and paste it in eclipse projects manifest.
打开Android studio项目的Android manifest,复制所有内容,粘贴到eclipse项目manifest中。
-
clean and run the project.
清理并运行项目。
#11
0
Simple way to move project from android studio to eclipse.
将项目从android studio移动到eclipse的简单方法。
1) Import project in eclipse .There is no file in src folder in these project.
1)eclipse中导入项目,项目中src文件夹中没有文件。
2) Go to the java folder that is available in folder stucture which you imported in eclipse. Copy the folder which is inside java it would be most of the time started from 'com' and paste in source 'src' folder .
2)转到在eclipse中导入的文件夹stucture中可用的java文件夹。复制java中的文件夹,大多数时候从'com'开始,粘贴到源'src'文件夹中。
Now you can compile your projrct it would work. if your project require third party libs then add the required file also.
现在可以编译项目了。如果您的项目需要第三方libs,那么也要添加所需的文件。
#1
41
It's not possible. We intend to add support for Gradle-based project in ADT but it's not currently possible.
这是不可能的。我们打算在ADT中增加对基于等级的项目的支持,但目前还不可能。
#2
69
You cannot import the project directly but it's not to hard to achieve it:
你不能直接导入项目,但实现它并不难:
- Create a new Android empty project in eclipse
- 在eclipse中创建一个新的Android空项目
- Overwrite the fresh res/ folder and the AndroidManifest.xml file, with the ones from the Android Studio project
- 覆盖新的res/文件夹和AndroidManifest。xml文件,以及来自Android Studio项目的文件
- 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
- 从Android Studio项目中复制java/文件夹的内容(它应该包含您的包名文件夹结构,比如com/ example/app/0,当然还有java文件)到Eclipse src文件夹中
- 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
基本上,Android应用程序的基本元素是java文件、清单文件和资源。从那里,您可以在您喜欢的IDE中构建一个项目
#3
3
Step-by-Step process to import Android Studio Project into Eclipse...
逐步将Android Studio项目导入Eclipse的过程……
-
Start new Android Project in eclipse using wizard and fill following details from app/build.gradle
使用向导在eclipse中启动新的Android项目,并从app/build.gradle中填写以下细节
ApplicationName and ProjectName : - You can find project name from .iml file in / folder PackageName : MinSDK, TargetSDK and CompileSDK
你可以在/文件夹PackageName中找到项目名:MinSDK、TargetSDK和compile esdk
-
Click Next in the wizard and make sure that you have "unchecked" 'Create Activity' and "Create Custom Icon". Click Finish.
在向导中单击Next,确保您有“未检查”的“创建活动”和“创建自定义图标”。单击Finish。
-
Open AndroidManifest.xml file in new created project. Copy "application", "uses-permission" etc tags as is from app/src/main/AndroidManifest.xml
AndroidManifest开放。新创建的项目中的xml文件。从app/src/main/AndroidManifest.xml中复制“应用程序”、“使用许可”等标签。
-
Source Files : Replace all contents in AndroidStudio/app/src/main/java to Eclipse//src folder.
源文件:将AndroidStudio/app/src/main/java的所有内容替换为Eclipse//src文件夹。
-
Resource Files : Replace all contents in AndroidStudio/app/src/main/res to Eclipse//res folder.
资源文件:将AndroidStudio/app/src/main/res中的所有内容替换为Eclipse/ res文件夹。
-
Library files : Copy all libs from AndroidStudio/app/libs to Eclipse//libs folder.
库文件:将所有的libs从AndroidStudio/app/libs复制到Eclipse//libs文件夹。
-
Dependency Library : Import and Add AppCompact as a dependent library using Properties->Android->Library->Add
依赖库:使用属性(>Android->Library->Add)作为依赖库导入和添加AppCompact
-
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.
您可能无法将其直接部署到手机上,但您可以找到在bin文件夹中生成的.apk文件。
#4
2
UPDATE: see One Android project for Eclipse and Android Studio
更新:在Eclipse和Android Studio中看到一个Android项目。
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)
目前,如果您在Android Studio中创建Android项目,您将很难在Eclipse中打开它。(不过,打开经典的Android,添加构建。Android Studio中的等级应该更容易)
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)
因此,您可以打开(作为通用项目),然后将一些模块转换为Eclipse项目,但它仍然不能完全发挥功能(但是对于内部的快速视图可能就足够了)
from How to use Gradle to generate Eclipse and Intellij project files for Android projects
从如何使用Gradle为Android项目生成Eclipse和Intellij项目文件
As answered in Issue 57668 by Android team (raised by @arcone)
如Android team 57668期的回答(@arcone提出)
Project Member #2 x...@android.com
项目成员# 2 x…@android.com
The eclipse plugin is not compatible with the android plugin.
eclipse插件与android插件不兼容。
You will not be able to import an Android gradle project into Eclipse using the default Gradle support in Eclipse.
您将无法使用Eclipse中的默认等级支持将Android gradle项目导入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
要使它在Eclipse中工作,我们必须改变Eclipse的Gradle插件,就像我们修改IntelliJ中的Gradle支持一样
That is Android team is working on gradle plugin for IntelliJ and gradle plugin for Eclipse needs to be updated too.
Android团队正在开发IntelliJ的gradle插件,Eclipse的gradle插件也需要更新。
What is possible with Eclipse now is
现在Eclipse有什么可能呢?
THIS IS OUTDATED, see How to import Android Studio project in Eclipse?
这已经过时了,看看如何在Eclipse中导入Android Studio项目?
.1. import the project as general project
1。。作为一般项目导入项目
.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
。2。把2 Eclipse。“点”文件到模块中/OpenSpritz-Android/app/src/main和/OpenSpritz-Android/lib/src/main。
.project
. 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
. 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
。3。将现有的Android代码导入到工作区
you can then browse code in familiar way, but even after that you won't be able to run with Eclipse ADT.
然后,您可以以熟悉的方式浏览代码,但即使这样,您也无法使用Eclipse ADT运行代码。
.4.
。4。
Now you can run build and tasks with gradle
CLI or Nodeclipse/Enide Gradle for Eclipse (marketplace)
现在,您可以使用Eclipse(市场)的CLI或Nodeclipse/Enide gradle运行构建和任务
discuss at https://github.com/Nodeclipse/nodeclipse-1/issues/148
讨论https://github.com/Nodeclipse/nodeclipse-1/issues/148
Also answered in Can't run imported gradle android project in Eclipse
也回答了在Eclipse中不能运行导入的gradle android项目
#5
0
Import project then Properties > java build path > source tab....remove path to src....add path to java folder in the source code using add folde rbutton... then build your project as usual
导入项目然后属性> java构建路径>源标签....删除路径src ....使用add folde rbutton向源代码中的java文件夹添加路径…然后像往常一样构建项目
#6
0
I think its not possible to import an android studio project to eclipse, without very much hand work.
我认为,如果没有大量的手工工作,将android studio项目导入eclipse是不可能的。
#7
0
I really miss the automatic build feature in Eclipse but also hate the speed and bugs in Eclipse for Mac. It would be nice to have the best of both worlds. The project layout in Eclipse and Android Studio has a lot in difference and I guess it would be very difficult if not impossible to change the default layout. Therefore, I tried to create an empty Android project in Eclipse. Then I deleted the physical folders and files and created linked resources to reference those in the Android Studio project and voila! It works.
我真的很怀念Eclipse中的自动构建功能,但我也讨厌Mac在Eclipse中的速度和bug。Eclipse和Android Studio中的项目布局有很多不同之处,我想要改变默认布局是非常困难的。因此,我尝试在Eclipse中创建一个空的Android项目。然后,我删除了物理文件夹和文件,并创建了链接资源,以引用Android Studio项目中的那些文件。它的工作原理。
Here is my resource mapping:
这是我的资源映射:
AS-Project/app/src/main/AndroidManifest.xml -> Eclipse-Project/AndroidManifest.xml
AS-Project/app/src/main/res -> Eclipse-Project/res
AS-Project/app/src/main/assets -> Eclipse-Project/assets
AS-Project/app/src/main/java -> Eclipse-Project/src
AS-Project/app/libs -> Eclipse-Project/libs-as
Linked folder doesn't quite work for the "libs" folder. So I mapped it to a folder called "libs-as" and manually added the JARs to project build path. In the worst case I guess you could maintain two separate libs folders.
链接文件夹对“libs”文件夹不太适用。因此我将它映射到一个名为“libas”的文件夹,并将jar手动添加到项目构建路径中。在最坏的情况下,我猜您可以维护两个独立的libs文件夹。
P.S. It would be a good idea to put two projects side by side and use location variables to reference relative paths (e.g. ${PARENT-1-PROJECT_LOC})
将两个项目并排放在一起,并使用位置变量引用相对路径(例如${parent -1 project_loc})是个好主意。
#8
0
The published answer worked for me, but only after some mis-steps due to my inexperience with these IDEs. For any other beginner be careful with these ...
公开的答案对我起了作用,但只是在由于我对这些ide缺乏经验而出现了一些失误之后。对于其他初学者,要小心这些……
- use the same minimum, target and build SDKs
- 使用相同的最小值、目标和构建SDKs
- use the exact same project name, and watch the sequence of project directories based on the package name, for the correct location of the .java file[s]
- 使用完全相同的项目名称,并根据包名查看项目目录的顺序,以获得.java文件的正确位置。
- for the /res folder copy over missing directories
- 对于/res文件夹,在丢失的目录上复制
- edit [i used NotePad] all matching xml files, carefully choosing the correct mix of entries, some from each
- 编辑[我使用记事本]所有匹配的xml文件,仔细选择正确的条目组合,每个条目中有一些
After this there may still be some errors to contend with, but with some persistence you should be able to correct them.
在此之后,可能仍然有一些错误需要处理,但是通过某种持久性,您应该能够纠正它们。
#9
0
I just published a project that requires to work for Android Studio or Eclipse users. It's basically an Android Studio project, but I provided a gradle build file that developers can use to convert it to Eclipse.
我刚刚发布了一个需要为Android Studio或Eclipse用户工作的项目。它基本上是一个Android Studio项目,但我提供了一个gradle构建文件,开发者可以用它将其转换为Eclipse。
Basically developers would have to run the following command to convert the project to Eclipse:
基本上,开发人员必须运行以下命令才能将项目转换为Eclipse:
gradle -b eclipse.gradle eclipse
Here are the contents of eclipse.gradle:
这是日食的内容。
apply plugin: 'java'
apply plugin: 'eclipse'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
// Add the natures and build commands to the project
eclipse.project {
natures 'com.android.ide.eclipse.adt.AndroidNature'
natures 'org.eclipse.jdt.core.javanature'
buildCommands.clear();
buildCommand 'com.android.ide.eclipse.adt.ResourceManagerBuilder'
buildCommand 'com.android.ide.eclipse.adt.PreCompilerBuilder'
buildCommand 'org.eclipse.jdt.core.javabuilder'
buildCommand 'com.android.ide.eclipse.adt.ApkBuilder'
}
// The source code is in the java folder
sourceSets.main.java.srcDirs 'java'
dependencies {
// declare your dependencies here
}
Hope this helps
希望这有助于
Adding step-by-step procedure. 1. Install gradle. Note that if you have Android Studio you already have gradle. 2. Create an eclipse.gradle file in the root folder of your Android Studio project and copy the contents of the eclipse.gradle mentioned above. 3. Open a command prompt or terminal and run gradle -b eclipse.gradle 4. Try to open in Eclipse
添加循序渐进的过程。1。安装它。注意,如果你有Android Studio,你已经有了gradle。2。创建一个eclipse。在Android Studio项目的根文件夹中复制渐变文件并复制eclipse的内容。gradle上面提到的。3所示。打开命令提示符或终端,运行level -b eclipse。gradle 4。尝试在Eclipse中打开
#10
0
It's quite simple if you know the trick.
如果你知道诀窍的话,这很简单。
-
Replace the eclipse project Res folder with Android studio project's res folder.
将eclipse项目Res文件夹替换为Android studio项目的Res文件夹。
-
Go inside java folder and copy all folders and paste inside src folder of eclipse project.
进入java文件夹,复制所有文件夹,粘贴到eclipse项目的src文件夹中。
-
Open Android manifest of android studio project, copy all of the content and paste it in eclipse projects manifest.
打开Android studio项目的Android manifest,复制所有内容,粘贴到eclipse项目manifest中。
-
clean and run the project.
清理并运行项目。
#11
0
Simple way to move project from android studio to eclipse.
将项目从android studio移动到eclipse的简单方法。
1) Import project in eclipse .There is no file in src folder in these project.
1)eclipse中导入项目,项目中src文件夹中没有文件。
2) Go to the java folder that is available in folder stucture which you imported in eclipse. Copy the folder which is inside java it would be most of the time started from 'com' and paste in source 'src' folder .
2)转到在eclipse中导入的文件夹stucture中可用的java文件夹。复制java中的文件夹,大多数时候从'com'开始,粘贴到源'src'文件夹中。
Now you can compile your projrct it would work. if your project require third party libs then add the required file also.
现在可以编译项目了。如果您的项目需要第三方libs,那么也要添加所需的文件。