简体   繁体   English

Android Studio:将字节码转换为 dex 时出错:多个 dex 文件定义了 Ljavax/mail/internet/ParameterList$ToStringBuffer;

[英]Android Studio : Error converting bytecode to dex:Multiple dex files define Ljavax/mail/internet/ParameterList$ToStringBuffer;

I recently upgraded to Android Studio 3.0.1, and while running the program I get this error:我最近升级到 Android Studio 3.0.1,在运行程序时出现此错误:

这个

My build.gradle我的 build.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
    applicationId "com.mrunal.myadmin"
    minSdkVersion 19
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    vectorDrawables.useSupportLibrary = true
    multiDexEnabled true

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
}
}
 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'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.1'
implementation 'javax.mail:javax.mail-api:1.5.3'
implementation 'com.android.support:support-vector-drawable:26.1.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('libs/mail.jar')
 }
apply plugin: 'com.google.gms.google-services'

manifest files清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.felicity.myadmin">
<uses-permission android:name="android.permission.INTERNET" />
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:name="android.support.multidex.MultiDexApplication"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".Email_Activity"></activity>
</application>
</manifest>

I already tried我已经试过了

  • clean & rebuild清理和重建
  • removed the second compilation of jar去掉了jar的第二次编译

I have search lot of related questions on SO but nothing helps me.我在SO上搜索了很多相关问题,但没有任何帮助。 please, anyone, help me out请任何人帮助我

problem solved,问题解决了,

I just change implementation 'com.android.support:multidex:1.0.1'我只是改变了implementation 'com.android.support:multidex:1.0.1'

To

implementation 'com.android.support:multidex:1.0.2' and it works implementation 'com.android.support:multidex:1.0.2'并且它有效

Updating your multidex is just temporary remedy for your problem.更新您的 multidex 只是您问题的临时补救措施。 The same problem gonna bite you again if you're using proguard for your release apk.如果您在发布 apk 中使用 proguard,同样的问题会再次困扰您。

The problem probably because you're using the same library with:问题可能是因为您使用的是同一个库:

implementation 'javax.mail:javax.mail-api:1.5.3'

and

implementation files('libs/mail.jar')

Use only one.只使用一个。

You also don't need using:您也不需要使用:

implementation files('libs/mail.jar')

if you're using:如果您使用:

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

You probably don't need using a multidex for your apk because your dependencies is not exceed 65k limitation.您可能不需要为您的 apk 使用 multidex,因为您的依赖项不超过 65k 限制。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将字节码转换为dex时出错:多个dex文件,Android Studio 3.0 - Error converting bytecode to dex: Multiple dex files, Android Studio 3.0 错误:将字节码转换为dex时出错:多个dex文件定义 - Error:Error converting bytecode to dex: Multiple dex files define 错误:将字节码转换为dex时出错:原因:com.android.dex.DexException:多个dex文件定义了Lcom / example / admin / myapplication / MainActivity; - Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/example/admin/myapplication/MainActivity; 将字节码转换为dex时出错:原因:com.android.dex.DexException:多个dex文件定义了Lcom / RNFetchBlob / RNFetchBlobConst; - Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/RNFetchBlob/RNFetchBlobConst; 错误:将字节码转换为 dex 时出错:原因:com.android.dex.DexException:多个 dex 文件定义了 Lokhttp3/internal/http/RealResponseBody; - Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lokhttp3/internal/http/RealResponseBody; 将字节码转换为dex:原因:com.android.dex.DexException:定义了多个dex文件 - converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Android Studio:将字节码转换为dex时出错 - Android Studio: Error converting bytecode to dex Android studio 2.3.1将字节码转换为dex时出错 - Android studio 2.3.1 Error converting bytecode to dex android studio将字节码转换为dex时出错 - android studio Error converting bytecode to dex 错误:将字节码转换为dex时出错:原因:com.android.dex.DexException:多个dex文件定义了Lcom / google / android / gms / internal / zzee; - Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzee;
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM