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

前端 未结 2 1046
轻奢々
轻奢々 2020-11-27 19:11

I\'ve an app that needs to be build multiple times with different resources for different customers (branding, configuration, and pre-loaded data change between customers).<

2条回答
  •  情深已故
    2020-11-27 19:52

    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 %\platform-tools” to path.

    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.

    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”

    3. Build the Project: a. Expand APK 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. For multi dex builds- 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.

    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

    5. Debug Build: a. Launch the app b. Attach the debugger (DDMS>Devices > App). c. We able to debug on few devices checked.

提交回复
热议问题