我在过去遇到过这个问题,并且能够很容易地解决它。然而,这一次,我看不出是什么导致了它。对构建的唯一更改。我做的gradle,因为它起作用了
implementation project(':sharedfiles')
-用于穿戴/移动设备的共享通用模块。我没有添加这个,我添加了模块作为依赖项,这一行是自动添加的,所以我怀疑这是一个错误。我有
multipleDexEnabled true
并且找不到任何冲突的依赖项。任何帮助都将不胜感激,这是我第一次使用通用模块。这是两个版本。gradle文件。
移动模块
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "bhprograms.supremis"
minSdkVersion 23
targetSdkVersion 26
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
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'
wearApp project(':wear')
implementation 'com.google.android.gms:play-services-wearable:+'
implementation files('libs/gson.jar')
implementation project(':sharedfiles')
}
通用模块
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 23
targetSdkVersion 26
versionCode 1
multiDexEnabled true
minSdkVersion 23
targetSdkVersion 26
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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'
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 files('libs/gson.jar')
}
当然,还有错误。
Error:Execution failed for task ':mobile:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex