1
您好,我在eclipse中使用gradle构建了一个android应用程序。我总是使用gradle在命令行中构建项目。现在我尝试在android设备模拟器上的eclipse中构建并运行它。在eclipse中,我不知道如何使用gradle在Android模拟器设备上运行它来构建项目。请我需要帮助。 你可以找到我的buil.gradle文件波纹管如何在eclipse中使用gradle构建并运行android项目
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':appcompat_v7')
compile "org.igniterealtime.smack:smack-android:4.1.0-rc1"
compile "org.igniterealtime.smack:smack-tcp:4.1.0-rc1"
// optional features
compile "org.igniterealtime.smack:smack-android-extensions:4.1.0-rc1"
}
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
mavenCentral()
}
android {
lintOptions{
abortOnError false
}
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
我不认为Eclipse支持gradle。你为什么不使用Android Studio? – nasch
我熟悉日食(我使用它的android开发约2年没有gradle),但我感谢,我将使用android工作室。你认为Studio对android开发比Eclipse好吗? @nasch – angel
是的,因为Eclipse ADT已被弃用,Google不再开发它。其次,正如您发现gradle很棒并与Android Studio集成在一起。我没有任何麻烦进行转换,我认为如果不是更好,它至少与IDE一样好。它的确和Eclipse有相同的内存问题。 – nasch