简体   繁体   English

Android Studio:添加空白任务时构建失败

[英]Android Studio: Build fails when I add a Blank Task

I am using the Azure Mobile Service Quick Start Project. 我正在使用Azure移动服务快速入门项目。 Imported from Eclipse to Android Studio and it builds and runs fine. 从Eclipse导入到Android Studio,它可以正常运行。

But as soon as I add a Blank Activity the Build fails: 但是,一旦添加空白活动,构建就会失败:

Error:Execution failed for task ':dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
...
...
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define       Landroid/support/v4/accessibilityservice/
AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

I also noticed that it added the following to the build.gradle 我还注意到它在build.gradle中添加了以下内容

dependencies {
compile fileTree(include: '*.jar', dir: 'libs')
compile 'com.android.support:appcompat-v7:20.0.0'
}

If I comment the addition to the gradle, I receive a whole host of errors...I am pretty sure it belongs there. 如果我对gradle的添加发表评论,我会收到很多错误...我很确定它属于该错误。

And if I remove my activity, the layout and the related menu or strings...it builds fine again. 而且,如果我删除活动,布局以及相关的菜单或字符串...,它将再次正常运行。

I've worked through many posts where people received similar errors but couldn't find a solution for my problem. 我处理过很多帖子,在这些帖子中人们收到了类似的错误,但是找不到解决我问题的方法。

I've also tried, restarting, clean build and rebuild. 我也尝试过,重新启动,清理构建并重新构建。

I would really appreciate some help...thanks 我真的很感谢您的帮助...谢谢

After commenting below in my app directory's build.gradle ..it worked again 在我的应用程序目录的build.gradle中评论以下内容后。

dependencies {
//    compile 'com.android.support:support-v4:+'
compile 'com.google.code.gson:gson:2.2.2'
compile files('libs/mobileservices-1.1.5.jar')
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM