gpt4 book ai didi

android - 如何在Eclipse中使用Gradle构建和运行Android项目

转载 作者:行者123 更新时间:2023-12-03 04:38:25 24 4
gpt4 key购买 nike

您好,我在Eclipse中使用Gradle构建了一个Android应用。我总是使用gradle在命令行中构建项目。现在,我尝试在android设备模拟器上的Eclipse中构建和运行它。在Eclipse中,我不知道如何使用gradle构建项目,并在android仿真器设备上运行它。请我需要帮助。
您可以在下面找到我的buil.gradle文件

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')
}
}

最佳答案

您是否尝试添加gradle eclipse插件

apply plugin: "eclipse"

然后通过调用从build.gradle生成eclipse项目
gradle eclipse

您还应该从Eclipse市场上安装“Gradle IDE Pack”(帮助-> Eclipse Marketplace ...)。

关于android - 如何在Eclipse中使用Gradle构建和运行Android项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31235045/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com