我的问题是在添加build.gradle的路径时,我无法运行代码。
下面是我的build.gradle文件。
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':android-auto-scroll-view-pager-master 2')
compile project(':android-mapviewballoons')
compile project(':android-newpopupmenu-lib')
compile project(':android-support-v7-appcompat-master')
compile project(':ImageViewTouch')
compile project(':pulltorefresh')
compile files('libs/picasso-2.5.2.jar')
compile "com.google.android.gms:play-services-gcm:8.4.0"
}
android {
compileSdkVersion 20
buildToolsVersion "23.0.2"
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
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')
}
}
我得到的错误是:
错误:任务执行失败&#39;:XXX:dexDebug&#39;。
com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程&#39;命令&#39; C:\ Program Files \ Java \ jdk1.7.0_79 \ bin \的java.exe&#39;&#39;完成非零退出值2
我不知道build.gradle有什么问题。
请帮我解决。
答案 0 :(得分:0)
在gradle中尝试此代码:
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
答案 1 :(得分:0)
在gradle配置中声明multidex支持。
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}