我试图编写一个简单的Android应用程序,我收到此错误消息。请帮助
错误:任务':app:dexDebug'执行失败。
com.android.ide.common.internal.LoggedErrorException:无法运行命令: D:\ Users \ user \ AppData \ Local \ Android \ sdk \ build-tools \ 21.1.2 \ dx.bat --dex --no-optimize --output C:\ Users \ user \ Desktop \ SocialNetworking \ app \ build \ intermediates \ dex \ debug --input-list = C:\ Users \ user \ Desktop \ SocialNetworking \ app \ build \ intermediates \ tmp \ dex \ debug \ inputList.txt 错误代码: 2 输出: 意外的顶级例外情况: com.android.dex.DexException:多个dex文件定义Lbolts / AggregateException; 在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) 在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) 在com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) 在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) 在com.android.dx.merge.DexMerger.merge(DexMerger.java:189) 在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) 在com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) 在com.android.dx.command.dexer.Main.run(Main.java:246) 在com.android.dx.command.dexer.Main.main(Main.java:215) 在com.android.dx.command.Main.main(Main.java:106)
我的gradle构建如下
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "jason.orchid.com.socialnetworking"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories { mavenCentral() }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.parse.bolts:bolts-android:1.1.4'
compile 'com.facebook.android:facebook-android-sdk:3.23.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}
答案 0 :(得分:1)
这是因为您在依赖项中包含了if (8..12).include?(Time.now.month) # Is the current month in Aug thru Dec?
# Allowed to read reports that are before August of the current year
can :read, Report, "((year(created_at) <> #{Time.now.year}) AND (month(created_at) >= 8)) OR reports.author_id = #{user.id}"
elsif (1..4).include?(Time.now.month) # Is the current month in Jan thru April?
# Allowed to read reports that are before August of the previous year
can :read, Report, "(year(created_at) < #{Time.now.year-1}) AND (month(created_at) <= 7) OR reports.author_id = #{user.id}"
else # or is it in May to July... wdgaf!
can :read, Report, :all
end
两次。删除其中任何一个,问题就会得到解决。