有没有办法在 Android 项目中将 Eclipse 与 Gradle 集成?

我有带有标准 build.gradle 的 Android 项目(我还添加了 android 注释).

I have Android project with standard build.gradle (also I added android annotations).

我还安装了 Gradle 插件(来自 http://dist.springsource.org/release/GRECLIPSE/e4.3/) 到我的 Eclipse (Kepler) 并将项目转换为 Gradle 项目.

Also I installed Gradle plugin (from http://dist.springsource.org/release/GRECLIPSE/e4.3/) to my Eclipse (Kepler) and converted project to Gradle project.

不幸的是,我无法在我的 Eclipse 上运行 Gradle build(在 cmd 行中一切正常).

Unfortunately I cannot run Gradle build on my Eclipse (in cmd line everything works).

我的问题是如何让 Eclipse 像使用 Maven 一样使用 Gradle.

My question is how to make Eclipse works with Gradle just like with Maven.

推荐答案

为了能够使用 Eclipse 构建 Android gradle 项目,我遵循了以下说明:

In order to be able to build an Android gradle project with Eclipse I followed these instructions:

  1. 安装这些 Eclipse 插件:

  1. Install these Eclipse plugins:

  • Gradle IDE (3.4.0)
  • Android 开发工具 (22.3.0)

如果你有一个老式的 android 项目布局,改变你的build.gradle 配置源目录,如 AndroidGradle 用户指南.

If you have an old-style android project layout, change your build.gradle to configure source directories as explained in the Android Gradle User Guide.

如果您有一个 gradle android 项目布局,请在项目的根目录中创建两个符号链接.

If you have a gradle android project layout, create two symbolic links into the root of your project.

ln -s src/main/res res
ln -s src/main/AndroidManifest.xml AndroidManifest.xml

ln -s src/main/res res
ln -s src/main/AndroidManifest.xml AndroidManifest.xml

希望对你有帮助!

相关文章