如何在Eclipse中打开Android Studio项目?

时间:2022-01-18 10:54:13

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插件,例如Blackberry 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中添加对基于Gradle的项目的支持,但目前还不可能。

#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
  • 使用Android Studio项目中的文件覆盖新的res /文件夹和AndroidManifest.xml文件

  • 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
  • 在Eclipse src文件夹中复制来自Android Studio项目的java /文件夹的内容(它应该包含您的包名称文件夹结构,如com / example / app /,当然还有java文件)

  • 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的循序渐进过程...

  1. Start new Android Project in eclipse using wizard and fill following details from app/build.gradle

    使用向导在eclipse中启动新的Android Project并填写app / build.gradle中的以下详细信息

    ApplicationName and ProjectName : - You can find project name from .iml file in / folderPackageName : MinSDK, TargetSDK and CompileSDK

    ApplicationName和ProjectName: - 您可以在/ folderPackageName中的.iml文件中找到项目名称:MinSDK,TargetSDK和CompileSDK

  2. Click Next in the wizard and make sure that you have "unchecked" 'Create Activity' and "Create Custom Icon". Click Finish.

    在向导中单击“下一步”,确保“未选中”“创建活动”和“创建自定义图标”。单击完成。

  3. 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复制“application”,“uses-permission”等标签

  4. Source Files : Replace all contents in AndroidStudio/app/src/main/java to Eclipse//src folder.

    源文件:将AndroidStudio / app / src / main / java中的所有内容替换为Eclipse // src文件夹。

  5. Resource Files : Replace all contents in AndroidStudio/app/src/main/res to Eclipse//res folder.

    资源文件:将AndroidStudio / app / src / main / res中的所有内容替换为Eclipse // res文件夹。

  6. Library files : Copy all libs from AndroidStudio/app/libs to Eclipse//libs folder.

    库文件:将所有库从AndroidStudio / app / libs复制到Eclipse // libs文件夹。

  7. Dependency Library : Import and Add AppCompact as a dependent library using Properties->Android->Library->Add

    依赖库:使用Properties-> Android-> Library-> Add将AppCompact导入并添加为依赖库

  8. Resolve any errors to build. Clean and Build again as a last step.

    解决要构建的任何错误。作为最后一步再次清洁和构建。

  9. 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 Studio中添加build.gradle打开经典Android会更容易)

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团队在问题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中的默认Gradle支持将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

0.1。将项目导入为一般项目

.project

<?xml version="1.0" encoding="UTF-8"?><projectDescription>    <name>OpenSpritz-Android</name>    <comment></comment>    <projects>    </projects>    <buildSpec>    </buildSpec>    <natures>    </natures></projectDescription>

如何在Eclipse中打开Android Studio项目?

.2. Put 2 Eclipse . "dot" files into modules into /OpenSpritz-Android/app/src/main and /OpenSpritz-Android/lib/src/main

0.2。放2个Eclipse。将“dot”文件分成模块放入/ OpenSpritz -Android / app / src / main和/ OpenSpritz -Android / lib / src / main

如何在Eclipse中打开Android Studio项目?

.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

0.3。作为现有Android代码导入Workspace

如何在Eclipse中打开Android Studio项目?

you can then browse code in familiar way, buteven after that you won't be able to run with Eclipse ADT.

然后,您可以以熟悉的方式浏览代码,之后您将无法使用Eclipse ADT运行。

.4.

Now you can run build and tasks with gradle CLI or Nodeclipse/Enide Gradle for Eclipse(marketplace)

现在,您可以使用gradle CLI或Nodeclipse / Enide Gradle for Eclipse(市场)运行构建和任务

如何在Eclipse中打开Android Studio项目?

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的路径....使用添加folde rbutton在源代码中添加java文件夹的路径...然后像往常一样构建项目

如何在Eclipse中打开Android Studio项目?

#6


0  

I think its not possible to import an android studio project to eclipse, without very much hand work.

我认为不可能将android工作室项目导入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中的自动构建功能,但也讨厌Eclipse for Mac中的速度和错误。拥有两全其美的东西会很不错。 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”文件夹。所以我将它映射到一个名为“libs-as”的文件夹,并手动将JAR添加到项目构建路径中。在最坏的情况下,我猜你可以维护两个独立的libs文件夹。

如何在Eclipse中打开Android Studio项目?

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缺乏经验,只是在一些错误的步骤之后。对于任何其他初学者要小心这些......

  1. use the same minimum, target and build SDKs
  2. 使用相同的最小值,目标和构建SDK

  3. 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]
  4. 使用完全相同的项目名称,并根据包名称查看项目目录的顺序,以获取.java文件的正确位置[s]

  5. for the /res folder copy over missing directories
  6. 用于/ res文件夹复制丢失的目录

  7. edit [i used NotePad] all matching xml files, carefully choosing the correct mix of entries, some from each
  8. 编辑[我使用NotePad]所有匹配的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:

以下是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 projecteclipse.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 foldersourceSets.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.gradle4. Try to open in Eclipse

添加逐步程序。安装gradle。请注意,如果你有Android Studio,那么你已经有了gradle.2。在Android Studio项目的根文件夹中创建一个eclipse.gradle文件,并复制上面提到的eclipse.gradle的内容。打开命令提示符或终端并运行gradle -b eclipse.gradle4。尝试在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.

    用Android studio项目的res文件夹替换eclipse项目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清单,复制所有内容并将其粘贴到eclipse项目清单中。

  • 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中导入的文件夹结构中可用的java文件夹。复制java中的文件夹,它是从'com'开始的大部分时间并粘贴在source'src'文件夹中。

Now you can compile your projrct it would work. if your project require third party libs then add the required file also.

现在你可以编译它可以工作的项目了。如果您的项目需要第三方库,那么也要添加所需的文件。

#1


41  

It's not possible. We intend to add support for Gradle-based project in ADT but it's not currently possible.

这是不可能的。我们打算在ADT中添加对基于Gradle的项目的支持,但目前还不可能。

#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
  • 使用Android Studio项目中的文件覆盖新的res /文件夹和AndroidManifest.xml文件

  • 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
  • 在Eclipse src文件夹中复制来自Android Studio项目的java /文件夹的内容(它应该包含您的包名称文件夹结构,如com / example / app /,当然还有java文件)

  • 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的循序渐进过程...

  1. Start new Android Project in eclipse using wizard and fill following details from app/build.gradle

    使用向导在eclipse中启动新的Android Project并填写app / build.gradle中的以下详细信息

    ApplicationName and ProjectName : - You can find project name from .iml file in / folderPackageName : MinSDK, TargetSDK and CompileSDK

    ApplicationName和ProjectName: - 您可以在/ folderPackageName中的.iml文件中找到项目名称:MinSDK,TargetSDK和CompileSDK

  2. Click Next in the wizard and make sure that you have "unchecked" 'Create Activity' and "Create Custom Icon". Click Finish.

    在向导中单击“下一步”,确保“未选中”“创建活动”和“创建自定义图标”。单击完成。

  3. 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复制“application”,“uses-permission”等标签

  4. Source Files : Replace all contents in AndroidStudio/app/src/main/java to Eclipse//src folder.

    源文件:将AndroidStudio / app / src / main / java中的所有内容替换为Eclipse // src文件夹。

  5. Resource Files : Replace all contents in AndroidStudio/app/src/main/res to Eclipse//res folder.

    资源文件:将AndroidStudio / app / src / main / res中的所有内容替换为Eclipse // res文件夹。

  6. Library files : Copy all libs from AndroidStudio/app/libs to Eclipse//libs folder.

    库文件:将所有库从AndroidStudio / app / libs复制到Eclipse // libs文件夹。

  7. Dependency Library : Import and Add AppCompact as a dependent library using Properties->Android->Library->Add

    依赖库:使用Properties-> Android-> Library-> Add将AppCompact导入并添加为依赖库

  8. Resolve any errors to build. Clean and Build again as a last step.

    解决要构建的任何错误。作为最后一步再次清洁和构建。

  9. 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 Studio中添加build.gradle打开经典Android会更容易)

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团队在问题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中的默认Gradle支持将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

0.1。将项目导入为一般项目

.project

<?xml version="1.0" encoding="UTF-8"?><projectDescription>    <name>OpenSpritz-Android</name>    <comment></comment>    <projects>    </projects>    <buildSpec>    </buildSpec>    <natures>    </natures></projectDescription>

如何在Eclipse中打开Android Studio项目?

.2. Put 2 Eclipse . "dot" files into modules into /OpenSpritz-Android/app/src/main and /OpenSpritz-Android/lib/src/main

0.2。放2个Eclipse。将“dot”文件分成模块放入/ OpenSpritz -Android / app / src / main和/ OpenSpritz -Android / lib / src / main

如何在Eclipse中打开Android Studio项目?

.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

0.3。作为现有Android代码导入Workspace

如何在Eclipse中打开Android Studio项目?

you can then browse code in familiar way, buteven after that you won't be able to run with Eclipse ADT.

然后,您可以以熟悉的方式浏览代码,之后您将无法使用Eclipse ADT运行。

.4.

Now you can run build and tasks with gradle CLI or Nodeclipse/Enide Gradle for Eclipse(marketplace)

现在,您可以使用gradle CLI或Nodeclipse / Enide Gradle for Eclipse(市场)运行构建和任务

如何在Eclipse中打开Android Studio项目?

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的路径....使用添加folde rbutton在源代码中添加java文件夹的路径...然后像往常一样构建项目

如何在Eclipse中打开Android Studio项目?

#6


0  

I think its not possible to import an android studio project to eclipse, without very much hand work.

我认为不可能将android工作室项目导入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中的自动构建功能,但也讨厌Eclipse for Mac中的速度和错误。拥有两全其美的东西会很不错。 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”文件夹。所以我将它映射到一个名为“libs-as”的文件夹,并手动将JAR添加到项目构建路径中。在最坏的情况下,我猜你可以维护两个独立的libs文件夹。

如何在Eclipse中打开Android Studio项目?

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缺乏经验,只是在一些错误的步骤之后。对于任何其他初学者要小心这些......

  1. use the same minimum, target and build SDKs
  2. 使用相同的最小值,目标和构建SDK

  3. 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]
  4. 使用完全相同的项目名称,并根据包名称查看项目目录的顺序,以获取.java文件的正确位置[s]

  5. for the /res folder copy over missing directories
  6. 用于/ res文件夹复制丢失的目录

  7. edit [i used NotePad] all matching xml files, carefully choosing the correct mix of entries, some from each
  8. 编辑[我使用NotePad]所有匹配的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:

以下是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 projecteclipse.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 foldersourceSets.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.gradle4. Try to open in Eclipse

添加逐步程序。安装gradle。请注意,如果你有Android Studio,那么你已经有了gradle.2。在Android Studio项目的根文件夹中创建一个eclipse.gradle文件,并复制上面提到的eclipse.gradle的内容。打开命令提示符或终端并运行gradle -b eclipse.gradle4。尝试在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.

    用Android studio项目的res文件夹替换eclipse项目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清单,复制所有内容并将其粘贴到eclipse项目清单中。

  • 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中导入的文件夹结构中可用的java文件夹。复制java中的文件夹,它是从'com'开始的大部分时间并粘贴在source'src'文件夹中。

Now you can compile your projrct it would work. if your project require third party libs then add the required file also.

现在你可以编译它可以工作的项目了。如果您的项目需要第三方库,那么也要添加所需的文件。