即使添加了multidex启用后,我也收到了这个dex合并错误..看看这段代码并帮助我..
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.aaryanverma.irac"
minSdkVersion 19
targetSdkVersion 24
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
}
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.0'
testImplementation 'junit:junit:4.12'
compile 'com.google.code.gson:gson:2.8.0'
compile 'commons-lang:commons-lang:2.4'
testImplementation 'com.microsoft.projectoxford:vision:1.0.393'
implementation 'com.microsoft.projectoxford:vision:1.0.393'
implementation 'commons-io:commons-io:2.6'
implementation 'com.microsoft.projectoxford:emotion:1.0.355'
implementation 'com.microsoft.projectoxford:face:1.3.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
// implementation group: 'com.mashape.unirest', name: 'unirest-java', version: '1.4.9'
//implementation group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
implementation group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.3'
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.5'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.4'
implementation 'com.android.support:multidex:1.0.1'
}
答案 0 :(得分:0)
要启用multidex,将multidexEnabled
设置为true并不是minsedk版本为19时唯一需要的。检查docs。
如果您有应用程序类,则需要将其扩展为MultiDexApplication
。如果您已经扩展了其他内容,则需要在应用程序类的MultiDex.install(this)
方法中调用attachBaseContext()
。
如果您没有应用程序类,则需要将其添加到清单中:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>