简体   繁体   English

如何在 eclipse exp 项目上运行 gradle 项目:https://github.com/nkzawa/socket.io-android-chat

[英]How to run a gradle project on eclipse exp project: https://github.com/nkzawa/socket.io-android-chat

Just a beginner in android, Was trying to learn Android and socket IO interaction.只是一个android初学者,正在尝试学习Android和socket IO交互。 So picked up a opensource hello world project as mentioned.所以选择了一个开源的 hello world 项目。 But I am not getting how to run such gradle project to my virtual AVD.但是我不知道如何将这样的 gradle 项目运行到我的虚拟 AVD。 I have eclipse and Android sdk on ubuntu 14.04.我在 ubuntu 14.04 上有 eclipse 和 Android sdk。 Thanks谢谢

You can generate eclipse project by using gradle eclipse plugin .您可以使用gradle eclipse plugin生成 eclipse 项目。 In your build.gradle ,在您的build.gradle

apply plugin: 'eclipse'

and with running the following gradle task,并运行以下 gradle 任务,

$ gradle eclipse

eclipse project will be generated.将生成eclipse项目。 Another solution would be just using the gradle plugin for eclipse .另一种解决方案是仅使用eclipsegradle 插件

But I strongly recommend you to switch your IDE to AndroidStdio when it comes to Android development.但我强烈建议您在 Android 开发方面将您的 IDE 切换到AndroidStdio

I have a simple trick to import Android Studio Projects in Eclipse.我有一个简单的技巧可以在 Eclipse 中导入 Android Studio 项目。

  1. Create a new Android Project on Eclipse with default settings.使用默认设置在 Eclipse 上创建一个新的 Android 项目。
  2. Go to the workspace folder and open the project folder.转到工作区文件夹并打开项目文件夹。
  3. Now in parallel, open the gradle project in another folder.现在并行地,在另一个文件夹中打开 gradle 项目。
  4. Open the main application folder where the following folders/files will be there: java, res and AndroidManifest.xml打开主应用程序文件夹,其中将存在以下文件夹/文件:java、res 和 AndroidManifest.xml
  5. In you eclipse project (that you just created) folder, open the src folder and delete the contents of the folder.在您的 eclipse 项目(您刚刚创建的)文件夹中,打开 src 文件夹并删除该文件夹的内容。 Now paste the contents of the java folder (the one mentioned in step 4) (it will contain the complete source code)现在粘贴 java 文件夹的内容(第 4 步中提到的那个)(它将包含完整的源代码)
  6. In you eclipse project (that you just created) folder, open the res folder and delete the contents of the folder.在您的 eclipse 项目(您刚刚创建的)文件夹中,打开 res 文件夹并删除该文件夹的内容。 Now paste the contents of the res folder (the one mentioned in step 4) (it will contain all the resources of the project)现在粘贴 res 文件夹的内容(第 4 步中提到的那个)(它将包含项目的所有资源)
  7. In you eclipse project (that you just created) folder, you will also see the AndroidManifest.xml.在您的 eclipse 项目(您刚刚创建的)文件夹中,您还将看到 AndroidManifest.xml。 Now replace it with the AndroidManifest.xml of the gradle project (the one mentioned in step 4).现在将其替换为 gradle 项目的 AndroidManifest.xml(第 4 步中提到的那个)。
  8. Now go back to Eclipse, select the project you just created, hit F5 (to refresh the contents).现在回到 Eclipse,选择刚刚创建的项目,按 F5(刷新内容)。 Clean the project.清理项目。

Note: If there are any library dependencies for the project, you will have to locate it on the internet (or locate them if available in the gradle project) and copy it in the libs folder for you eclipse project.注意:如果项目有任何库依赖项,您必须在 Internet 上找到它(或者在 gradle 项目中找到它们)并将其复制到 eclipse 项目的 libs 文件夹中。 If the library is given as another project, follow the above steps again, right click on the library-project, and check the is Library option and import it as library in the application project.如果库是作为另一个项目给出的,则再次按照上述步骤操作,在库项目上单击鼠标右键,然后选中是库选项并将其作为库导入应用程序项目中。

Hope this helped.希望这有帮助。 Cheers :)干杯:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Eclipse从Github运行下载的嵌套演示Android项目? - How to run downloaded nested demo Android project from Github with Eclipse? 如何在eclipse中从github运行maven项目 - how to run maven project from github in eclipse 如何在当前的Eclipse Android项目中导入Gottox / socket.io-java-client api? - How to import the Gottox/socket.io-java-client api in current Eclipse Android Project? 无法在Eclipse中运行导入的gradle android项目 - Can't run imported gradle android project in Eclipse 如何在 eclipse gradle 项目的运行配置中设置环境变量? - How to set Environment variables in Run Configuration of an eclipse gradle project? 如何使用Eclipse和Gradle对Java项目运行Spock测试? - How to run Spock tests for Java project with eclipse and gradle? 如何在 eclipse 中重命名 gradle 项目? - How to rename a gradle project in eclipse? Android Studio: Could not find com.android.tools.build:gradle:3.6.2 during import an Eclipse project - Android Studio: Could not find com.android.tools.build:gradle:3.6.2 during import an Eclipse project 如何在 Eclipse 中运行 gitlab/github 克隆项目? (当它不是eclipse项目时) - How do I run a gitlab / github cloned project in eclipse? (When it is not an eclipse project) 如何使用github中的Eclipse项目进行Android开发 - How to use eclipse project from github for Android development
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM