Introduction:because Android Studio uses the Build tool Gradle, if Eclipse and Android studio want to build each other's apps, you must use Gradle. Gradle is based on the Groovy language and is oriented toward Java applications. Automated building tools based on DSL (domain-specific language) syntax. Home: http://www.gradle.org/Note: 1, because Android uses the Gradle version is 1.12, so download 1.12 version, using the high version will be an error. 2. When you export gradle.build in eclipse, if there are some dependencies error: Make sure all dependencies is opened, you want to ensure that the location of the dependency is the same as the project in workspace! Settings: 1, after downloading the gradle, you need to set the system environment variables,variable Name: Gradle_home variable Value: Your path \gradle-1.12,then add%gradle_home%\bin in the system variable path;2, also note that the Android environment variable is set, variable name:Android_homeVariable Value: The path to the ANDROIDSDK (for exampleE:\Program Files (x86) \ANDROID\ANDROID-STUDIO\SDK),then add in the system variable path%android_home%\tools; Example: Android samples are mostly built with Gradle after Android-18, so it's a hassle to look at the example apk build with Eclipse. Suppose I now want to build the Sdk\samples\android-19\ui\customnotifications apk view example directly. Directory structure Open cmd--"CD sample Directory-" Run Gradle build when you are finished seeing build success or in Customnotificationssample\build\outputs\ The APK folder to see that the build was successful. Let's try another example \sdk\samples\android-20\ui\textswitcher, is the step gradle so magical? Will the app be built automatically? In fact, in the process of construction, the use of build.gradle this file, the content is to build the script
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath ‘com.android.tools.build:gradle:0.10.+‘
}
}
apply plugin:‘android‘
dependencies {
// Add the support lib that is appropriate for SDK 4
compile "com.android.support:support-v4:19.1.+"
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs =[
‘main‘,// main sample code; look here for the interesting stuff.
‘common‘,// components that are reused by multiple samples
‘template‘]// boilerplate code that is generated by the sample template process
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot(‘tests‘)
androidTest.java.srcDirs =[‘tests/src‘]
}
}
In general, we use auto-generatedBuild.gradleOf course you can also write your own handwriting, but the premise is to go to the official website to learn relevant content. when Eclipse ADT is upgraded to version 22.0 or higher, we can use the exported Androidbuild.gradle function.
Follow the steps to go. In Android studio, import thisBuild.gradle can import the Eclipse project into Android Studio.
From for notes (Wiz)
Build Android Apps with Gradle