// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext {
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
archRoomVersion = "1.0.0-alpha1"
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' } //needed for Room
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用程序分级:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.myname.room_example"
minSdkVersion 21
targetSdkVersion 26
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] // Room schema
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:multidex:1.0.2'
implementation "android.arch.persistence.room:runtime:1.0.0-alpha1"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha1"
implementation 'com.android.support:support-annotations:27.0.0'
}
将buildtoolsversion
和supportlibversion
更新为下面代码中的最新版本。
ext {
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
archRoomVersion = "1.0.0-alpha1"
}
然后清理和重建项目,看看它是否有效。
问题内容: 这是我的应用程序级别gradle文件: 编译项目时出现的完整错误是: 错误:任务’:app:transformDexArchiveWithExternalLibsDexMergerForDebug’的执行失败。 java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex
应用程序构建: 任何帮助都将不胜感激,因为这个项目即将到期!
将我的项目更新为3级,并生成了此错误 java.lang.runtimeException:java.lang.runtimeException:com.android.builder.dexing.dexArchivEmergerException:无法合并dex 在Gradle2.3中不显示此错误 build.gradle应用程序应用插件:'com.android.application' B
错误:任务“:app:TransformDexArchiveWithExternalLibsDexMergerForDebug”执行失败。 java.lang.RuntimeException:com.android.builder.dexing.DexArchivEmergerException:无法合并dex 我尝试了以下帖子推荐的每一个解决方案: 后1 职位2 这是我的应用程序Gradle:
应用插件: 堆栈跟踪错误 失败:生成失败,出现异常。 请访问https://help.gradle.org获取更多帮助