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

时间:2022-01-18 10:53:43

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

我有一个带有标准构建的Android项目。gradle(我也添加了android注解)。

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

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

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

不幸的是,我不能在Eclipse上运行Gradle构建(在cmd行中,一切都可以工作)。

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

我的问题是如何使Eclipse与Gradle一起工作,就像与Maven一样。

4 个解决方案

#1


23  

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

为了能够使用Eclipse构建一个Android gradle项目,我遵循了以下指导:

  1. Install these Eclipse plugins:

    安装这些Eclipse插件:

    • Gradle IDE (3.4.0)
    • Gradle IDE(3.4.0)
    • Android Development Tools (22.3.0)
    • Android开发工具(22.3.0)
  2. 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.

    如果你有一个老式的android项目布局,改变你的构建。按照Android gradle用户指南中解释的方式配置源目录。

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

    如果你有一个等级的android项目布局,创建两个符号链接到你的项目的根。

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

    src/main/res - src/main/AndroidManifest。xml AndroidManifest.xml

I hope it helps!

我希望它可以帮助!

#2


3  

Read Is it possible to use the Gradle build system for Android with Eclipse?

是否可以在Eclipse中使用Android的Gradle构建系统?

try Nodeclipse/Enide Gradle for Eclipse (marketplace)

试试Eclipse(市场)的Nodeclipse/Enide Gradle

Some screenshots for Gradle for Eclipse:

为Eclipse的Gradle的一些屏幕截图:

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

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

#3


2  

I use neon eclipse for android developer with gradle integration. Also, I use gradle plugin (com.github.ginvavilon:android-eclipse) for generating .project and .classpath for new structure of android project (src/main/java; src/main/res ...). Flavors and build types are supported. And use that project as gradle-project

我在android开发者中使用了neon eclipse和gradle集成。此外,我使用gradle插件(com.github.ginvavilon:android-eclipse)为android项目的新结构生成.project和.classpath (src/main/java;src / main / res……)。支持风味和构建类型。把这个项目作为一级项目

#4


0  

  1. Install Gradle:
    a. http://gradle.org/gradle-download/ b. Choose 2.1 from previous releases section. c. Unzip at convenient folder.(Ex : D:\Graddle\gradle-2.1) d. Set system environment variables. i. GRADLE_HOME as D:\Graddle\gradle-2.1) ii. GRADLE_OPTS as -XX:MaxPermSize=512m iii. %GRADLE_HOME%\bin to Path iv. Set ANDROID_HOME ( Ex: D:\android-sdk) v. Append “%ANDROID_HOME %\platform-tools” to path.
  2. 安装Gradle: a. http://gradle.org/gradle download/ b.从之前的版本中选择2.1。在方便的文件夹解压。(Ex: D:\Graddle\gradl -2.1) D .设置系统环境变量。i. GRADLE_HOME as D:\Graddle\等级2.1)ii。GRADLE_OPTS - xx:MaxPermSize = 512 iii。设置ANDROID_HOME(例如:D:\ androidd -sdk) v.在Path中添加“%ANDROID_HOME %\ home %\platform-tools”。

e. Open command prompt and check gradle is set. May use gradle -version to check.

打开命令提示符并检查等级设置,可使用等级版本进行检查。

  1. Install Gradle eclipse PlugIn: a. Launch Eclipse b. Help > Eclipse Market Place c. Search “gradle” d. In that choose “Nodeeclipse/enide” e. Select all listed, accept & install. f. Restart eclipse once installed.

    安装Gradle eclipse插件:a.启动eclipse b.帮助> eclipse Market Place c. Search“Gradle”d.选择“Nodeeclipse/enide”e.选择所有列出的、接受和安装的。f.重新启动eclipse。

  2. Set Gradle & Java Homes : a. Launch eclipse. b. Window > Preferences > Gradle EnIDE c. Set these if not set : i. Gradle home to use is set ( Ex: D:\Graddle\gradle-2.1) ii. Alternate JAVA_HOME to use is set ( Ex : C:\Program Files (x86)\Java\jdk1.7.0_60) iii. JVM options for GRADLE_OPTS is set to “-XX:MaxPermSize=512m”

    设置等级和Java家庭:a.启动eclipse。b.窗口>首选项> Gradle EnIDE c.设置(如果没有设置):i.设置家庭使用等级(例如:D:\ Gradle \ 2.1) ii。替代JAVA_HOME使用设置(例:C:\Program Files (x86)\Java\ jdk1.7.0_60)iii。GRADLE_OPTS的JVM选项设置为“-XX:MaxPermSize=512m”

  3. Build the Project: a. Expand PhoneDishAnywhere in eclipse Java explorer. b. Right click on build.gradle c. Run As > Gradle GUI d. Comand Line : gradle clean build e. Wait for build to complete : First time build will take several minutes. f. If Build dex error or Java heap space error : i. Open build.gradle in editor. ii. Set appropriate javaMaxHeapSize based on your java (javaMaxHeapSize=1024M for 32bit Java,2048M for 64bit Java) iii. May comment signing (//apply from: "$rootProject.projectDir/jenkins_config/gradle/signing.gradle";) to avoid signing for debug build. iv. Build again after these fixes.

    构建项目:a.在eclipse Java explorer中扩展PhoneDishAnywhere。右键单击build。c级。以>级图形界面线运行。第一次构建需要几分钟。f.如果构建dex错误或Java堆空间错误:i.打开构建。它在编辑器。二世。根据java设置适当的javaMaxHeapSize (32bit java的javaMaxHeapSize=1024M, 64bit java的2048M) iii。可以注释签名(//应用于:“$rootProject.projectDir/jenkins_config/gradle/sign .gradle”;),以避免为调试构建进行签名。在这些修复之后再次构建。

  4. Install Build On device: a. Connect the device to m/c. b. Right click on build.gradle c. Run As > gradle installDebug Gradle Android start d. Wait for install to complete

    在设备上安装:a.连接设备到m/c。右键单击build。等级c.以>级安装方式运行

#1


23  

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

为了能够使用Eclipse构建一个Android gradle项目,我遵循了以下指导:

  1. Install these Eclipse plugins:

    安装这些Eclipse插件:

    • Gradle IDE (3.4.0)
    • Gradle IDE(3.4.0)
    • Android Development Tools (22.3.0)
    • Android开发工具(22.3.0)
  2. 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.

    如果你有一个老式的android项目布局,改变你的构建。按照Android gradle用户指南中解释的方式配置源目录。

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

    如果你有一个等级的android项目布局,创建两个符号链接到你的项目的根。

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

    src/main/res - src/main/AndroidManifest。xml AndroidManifest.xml

I hope it helps!

我希望它可以帮助!

#2


3  

Read Is it possible to use the Gradle build system for Android with Eclipse?

是否可以在Eclipse中使用Android的Gradle构建系统?

try Nodeclipse/Enide Gradle for Eclipse (marketplace)

试试Eclipse(市场)的Nodeclipse/Enide Gradle

Some screenshots for Gradle for Eclipse:

为Eclipse的Gradle的一些屏幕截图:

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

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

#3


2  

I use neon eclipse for android developer with gradle integration. Also, I use gradle plugin (com.github.ginvavilon:android-eclipse) for generating .project and .classpath for new structure of android project (src/main/java; src/main/res ...). Flavors and build types are supported. And use that project as gradle-project

我在android开发者中使用了neon eclipse和gradle集成。此外,我使用gradle插件(com.github.ginvavilon:android-eclipse)为android项目的新结构生成.project和.classpath (src/main/java;src / main / res……)。支持风味和构建类型。把这个项目作为一级项目

#4


0  

  1. Install Gradle:
    a. http://gradle.org/gradle-download/ b. Choose 2.1 from previous releases section. c. Unzip at convenient folder.(Ex : D:\Graddle\gradle-2.1) d. Set system environment variables. i. GRADLE_HOME as D:\Graddle\gradle-2.1) ii. GRADLE_OPTS as -XX:MaxPermSize=512m iii. %GRADLE_HOME%\bin to Path iv. Set ANDROID_HOME ( Ex: D:\android-sdk) v. Append “%ANDROID_HOME %\platform-tools” to path.
  2. 安装Gradle: a. http://gradle.org/gradle download/ b.从之前的版本中选择2.1。在方便的文件夹解压。(Ex: D:\Graddle\gradl -2.1) D .设置系统环境变量。i. GRADLE_HOME as D:\Graddle\等级2.1)ii。GRADLE_OPTS - xx:MaxPermSize = 512 iii。设置ANDROID_HOME(例如:D:\ androidd -sdk) v.在Path中添加“%ANDROID_HOME %\ home %\platform-tools”。

e. Open command prompt and check gradle is set. May use gradle -version to check.

打开命令提示符并检查等级设置,可使用等级版本进行检查。

  1. Install Gradle eclipse PlugIn: a. Launch Eclipse b. Help > Eclipse Market Place c. Search “gradle” d. In that choose “Nodeeclipse/enide” e. Select all listed, accept & install. f. Restart eclipse once installed.

    安装Gradle eclipse插件:a.启动eclipse b.帮助> eclipse Market Place c. Search“Gradle”d.选择“Nodeeclipse/enide”e.选择所有列出的、接受和安装的。f.重新启动eclipse。

  2. Set Gradle & Java Homes : a. Launch eclipse. b. Window > Preferences > Gradle EnIDE c. Set these if not set : i. Gradle home to use is set ( Ex: D:\Graddle\gradle-2.1) ii. Alternate JAVA_HOME to use is set ( Ex : C:\Program Files (x86)\Java\jdk1.7.0_60) iii. JVM options for GRADLE_OPTS is set to “-XX:MaxPermSize=512m”

    设置等级和Java家庭:a.启动eclipse。b.窗口>首选项> Gradle EnIDE c.设置(如果没有设置):i.设置家庭使用等级(例如:D:\ Gradle \ 2.1) ii。替代JAVA_HOME使用设置(例:C:\Program Files (x86)\Java\ jdk1.7.0_60)iii。GRADLE_OPTS的JVM选项设置为“-XX:MaxPermSize=512m”

  3. Build the Project: a. Expand PhoneDishAnywhere in eclipse Java explorer. b. Right click on build.gradle c. Run As > Gradle GUI d. Comand Line : gradle clean build e. Wait for build to complete : First time build will take several minutes. f. If Build dex error or Java heap space error : i. Open build.gradle in editor. ii. Set appropriate javaMaxHeapSize based on your java (javaMaxHeapSize=1024M for 32bit Java,2048M for 64bit Java) iii. May comment signing (//apply from: "$rootProject.projectDir/jenkins_config/gradle/signing.gradle";) to avoid signing for debug build. iv. Build again after these fixes.

    构建项目:a.在eclipse Java explorer中扩展PhoneDishAnywhere。右键单击build。c级。以>级图形界面线运行。第一次构建需要几分钟。f.如果构建dex错误或Java堆空间错误:i.打开构建。它在编辑器。二世。根据java设置适当的javaMaxHeapSize (32bit java的javaMaxHeapSize=1024M, 64bit java的2048M) iii。可以注释签名(//应用于:“$rootProject.projectDir/jenkins_config/gradle/sign .gradle”;),以避免为调试构建进行签名。在这些修复之后再次构建。

  4. Install Build On device: a. Connect the device to m/c. b. Right click on build.gradle c. Run As > gradle installDebug Gradle Android start d. Wait for install to complete

    在设备上安装:a.连接设备到m/c。右键单击build。等级c.以>级安装方式运行