android 多个dex 合并,android - 无法合并dex

我有Android Studio Beta。 我创建了一个新项目,编译我的旧模块,但是当我尝试启动应用程序时,它没有启动消息:

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException:无法合并dex

但我不知道如何解决这个错误。 我用谷歌搜索了几个小时但没有成功。

我的项目是:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {

jcenter()

google()

}

dependencies {

classpath 'com.android.tools.build:gradle:3.0.0-beta6'

classpath "io.realm:realm-gradle-plugin:3.7.1"

classpath 'com.google.gms:google-services:3.1.0'

// NOTE: Do not place your application dependencies here; they belong

// in the individual module build.gradle files

}

}

allprojects {

repositories {

jcenter()

google()

}

}

task clean(type: Delete) {

delete rootProject.buildDir

}

我的应用程序gradle:

apply plugin: 'com.android.application'

android {

compileSdkVersion 26

buildToolsVersion "26.0.1"

defaultConfig {

applicationId "parad0x.sk.onlyforyou"

minSdkVersion 21

targetSdkVersion 26

versionCode 1

versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

multiDexEnabled true

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}

debug {

}

}

compileOptions {

targetCompatibility 1.7

sourceCompatibility 1.7

}

packagingOptions {

exclude 'META-INF/LICENSE'

exclude 'META-INF/NOTICE'

}

lintOptions {

checkReleaseBuilds false

}

productFlavors {

}

}

dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {

exclude group: 'com.android.support', module: 'support-annotations'

})

//noinspection GradleCompatible

compile 'com.android.support:appcompat-v7:26.0.0-alpha1'

compile project(path: ':loginregisterview')

}

我的模块是gradle:

apply plugin: 'com.android.library'

apply plugin: 'realm-android'

android {

compileSdkVersion 26

buildToolsVersion "26.0.1"

defaultConfig {

minSdkVersion 19

targetSdkVersion 26

versionCode 1

versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}

}

}

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {

exclude group: 'com.android.support', module: 'support-annotations'

})

compile 'com.android.support:appcompat-v7:26.0.2'

compile 'com.android.support:support-v4:26.1.0'

compile 'com.github.bumptech.glide:glide:4.0.0'

testCompile 'junit:junit:4.12'

compile project(path: ':parser')

}

我的第二个模块:

apply plugin: 'com.android.library'

apply plugin: 'realm-android'

android {

compileSdkVersion 26

buildToolsVersion "26.0.1"

defaultConfig {

minSdkVersion 14

targetSdkVersion 23

versionCode 1

versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

realm {

syncEnabled = true

}

useLibrary 'org.apache.http.legacy'

buildTypes {

release {

minifyEnabled false

proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

}

}

productFlavors {

}

}

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])

androidTestCompile 'junit:junit:4.12'

// compile 'com.android.support:appcompat-v7:23.1.0'

// compile 'com.fasterxml.jackson.core:jackson-core:2.9.0'

// compile 'com.fasterxml.jackson.core:jackson-annotations:2.9.0'

// compile 'com.fasterxml.jackson.core:jackson-databind:2.9.0'

compile 'com.google.code.gson:gson:2.6.2'

}

____________finding_________

当我没有导入第二个模块(解析器)时,应用程序没有在dex上崩溃,但是当模块未导入时,应用程序无效。 :D:D

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值