Android - 使用最小 sdk 版本将字节码转换为 Dex 时出错
Android - Error Converting Bytecode to Dex with min sdk version
我正在尝试 运行 我的应用程序并不断遇到错误:
Error:Error converting bytecode to dex:
Cause: default or static interface method used without --min-sdk-version >= 24
我不确定哪里出了问题,因为它没有提供太多信息。之前是运行ning。我看过类似的问题,但它们是不同的。它们都与 build.gradle 中的依赖项有关,所以我在下面显示了这一点。
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 "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber', version: '8.4.3'
compile group: 'com.pubnub', name: 'pubnub-gson', version: '4.6.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.7.3'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.7.3'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.3'
compile group: 'com.google.guava', name: 'guava', version: '21.0'
compile group: 'joda-time', name: 'joda-time', version: '2.9.7'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.google.android.gms:play-services-location:10.2.6'
这里的罪魁祸首是番石榴
compile group: 'com.google.guava', name: 'guava', version: '21.0'
改为:
compile group: 'com.google.guava', name: 'guava', version: '22.0'
它会起作用
你可以在更新日志中看到:
https://github.com/google/guava/wiki/Release21
我正在尝试 运行 我的应用程序并不断遇到错误:
Error:Error converting bytecode to dex:
Cause: default or static interface method used without --min-sdk-version >= 24
我不确定哪里出了问题,因为它没有提供太多信息。之前是运行ning。我看过类似的问题,但它们是不同的。它们都与 build.gradle 中的依赖项有关,所以我在下面显示了这一点。
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 "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile group: 'com.googlecode.libphonenumber', name: 'libphonenumber', version: '8.4.3'
compile group: 'com.pubnub', name: 'pubnub-gson', version: '4.6.2'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.7.3'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.7.3'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.7.3'
compile group: 'com.google.guava', name: 'guava', version: '21.0'
compile group: 'joda-time', name: 'joda-time', version: '2.9.7'
compile 'com.google.android.gms:play-services-maps:10.2.6'
compile 'com.google.android.gms:play-services-location:10.2.6'
这里的罪魁祸首是番石榴
compile group: 'com.google.guava', name: 'guava', version: '21.0'
改为:
compile group: 'com.google.guava', name: 'guava', version: '22.0'
它会起作用
你可以在更新日志中看到: https://github.com/google/guava/wiki/Release21