- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
此类 dex 问题开始出现的具体时间不详。清除项目,使缓存无效无济于事。似乎我对 intellij 注释有问题,但包括或排除它对它没有任何影响。
当我从这个 post 添加解决方案时,问题貌似解决了,但是切换flavor后,又随机出现branch dex问题。是否有任何分步解决方案,一般如何摆脱 dex 问题?
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/JdkConstants$CursorType;
Error:com.android.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/JdkConstants$CursorType;
Error: at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
Error: at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
Error: at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
Error: at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Error: at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
Error: at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
Error: at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
Error: at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
Error: at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
Error: at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
Error: at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
Error: at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error:Execution failed for task ':app:transformDexArchiveWithDexMergerForAlfaDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lorg/intellij/lang/annotations/JdkConstants$CursorType;
这是我正在使用的 gradle 应用程序文件。
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.25.0'
classpath "io.realm:realm-gradle-plugin:1.0.0"
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'realm-android'
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
def versionPropsCode = 0
def versionPropsName = "1.0.0"
def versionPropsFile = file('version.properties')
def applicationName = "my.app.name"
def applicationIdName = "${applicationGroup}.${applicationName}"
def devApplicationIdName = "${applicationIdName}.dev"
def alfaApplicationIdName = "${applicationIdName}.alfa"
def betaApplicationIdName = "${applicationIdName}.beta"
def rcApplicationIdName = "${applicationIdName}.rc"
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId applicationIdName
minSdkVersion 15
targetSdkVersion 26
versionCode versionPropsCode
versionName versionPropsName
renderscriptTargetApi 15
renderscriptSupportModeEnabled true
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
setProperty("archivesBaseName", "$applicationId-$versionName-$versionCode")
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/INDEX.LIST'
}
buildTypes {
debug {}
release {
}
}
flavorDimensions "api"
productFlavors {
dev {
dimension "api"
applicationId devApplicationIdName
}
alfa {
dimension "api"
applicationId alfaApplicationIdName
}
beta {
dimension "api"
}
production {
dimension "api"
applicationId applicationIdName
}
}
testOptions {
animationsDisabled = true
}
}
ext {
supportLibVersion = '26.1.0'
firebaseLibVersion = '11.6.2'
gmsLibVersion = '11.0.2'
AAVersion = "4.3.1"
archVersion = "1.0.0"
}
configurations {
cleanedAnnotations
compile.exclude group: 'org.jetbrains' , module:'annotations'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true
exclude group: 'com.crashlytics.sdk.android:crashlytics', module: 'app'
}
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "com.android.support:support-annotations:$supportLibVersion"
implementation 'com.android.support:multidex:1.0.2'
implementation "com.android.support:appcompat-v7:$supportLibVersion"
implementation "com.android.support:cardview-v7:$supportLibVersion"
implementation "com.android.support:recyclerview-v7:$supportLibVersion"
implementation "com.android.support:support-v4:$supportLibVersion"
implementation "com.android.support:design:$supportLibVersion"
implementation "com.android.support:palette-v7:$supportLibVersion"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.google.android.gms:play-services-location:$firebaseLibVersion"
implementation "com.google.android.gms:play-services-analytics:$firebaseLibVersion"
implementation "com.google.android.gms:play-services-auth:$firebaseLibVersion"
implementation "com.google.firebase:firebase-appindexing:$firebaseLibVersion"
implementation "com.google.firebase:firebase-messaging:$firebaseLibVersion"
implementation "com.google.firebase:firebase-core:$firebaseLibVersion"
implementation "com.google.firebase:firebase-database:$firebaseLibVersion"
implementation "com.google.firebase:firebase-config:$firebaseLibVersion"
implementation 'com.firebase:firebase-client-android:2.3.1'
implementation 'com.facebook.android:facebook-android-sdk:4.27.0'
implementation 'com.facebook.network.connectionclass:connectionclass:1.0.1'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
implementation 'com.daimajia.easing:library:2.1@aar'
implementation 'com.github.ksoichiro:android-observablescrollview:1.6.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation('com.github.rey5137:material:1.2.4') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation("org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion") {
exclude group: 'org.jetbrains', module: 'annotations'
}
implementation 'com.squareup.okio:okio:1.13.0'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
implementation 'com.jakewharton:butterknife:8.8.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'eu.inloop:androidviewmodel:1.3.4'
implementation 'com.wefika:flowlayout:0.4.1'
implementation 'com.makeramen:roundedimageview:2.2.1'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'jp.wasabeef:recyclerview-animators:2.2.7'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0'
implementation 'it.sephiroth.android.library.easing:android-easing:1.0.3'
implementation 'org.apache.commons:commons-lang3:3.5'
implementation "android.arch.lifecycle:runtime:$archVersion"
implementation "android.arch.lifecycle:extensions:$archVersion"
implementation files("${buildDir}/libs/annotations-cleaned.jar") { builtBy 'cleanAnnotationsJar' }
cleanedAnnotations 'org.jetbrains:annotations:13.0'
implementation project(':paper-onboarding-release')
// Instrumentation test dependencies
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.0') {
exclude module: 'support-annotations'
}
androidTestImplementation('com.android.support.test.espresso:espresso-intents:3.0.0') {
exclude module: 'support-annotations'
}
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.0'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
androidTestImplementation ('com.github.andrzejchm.RESTMock:android:0.2.2')
// Unit tests dependencies
testImplementation 'junit:junit:4.12'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.4-beta2'
androidTestImplementation "com.android.support:support-annotations:$supportLibVersion"
implementation('com.android.support.test.espresso:espresso-idling-resource:3.0.0')
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation('com.facebook.stetho:stetho-okhttp:1.5.0') {
exclude group: 'com.squareup.okhttp'
}
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
cleanedAnnotations 'org.jetbrains:annotations:13.0'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
project.afterEvaluate {
project.android.applicationVariants.all { variant ->
variant.outputs.all { output ->
project.publishing.publications.create(variant.name, MavenPublication) {
groupId applicationIdName
version variant.versionName
artifactId variant.name
if (output.outputFile.exists()) {
artifact(output.outputFile)
}
}
}
}
}
List<String> artifactoryPublications = new ArrayList<String>()
project.android.applicationVariants.all { artifactoryPublications.add(it.name) }
artifactory {
contextUrl = "$System.env.ARTIFACTORY_PUBLISH_CONTEXT_URL"
publish {
repository {
repoKey = 'my-repo-key'
username = "$user"
password = "$pass"
}
defaults {
publishArtifacts = true
artifactoryPublications.each { publications(it) }
properties = ['qa.level': 'basic', 'dev.team': 'core']
publishIvy = false
publishPom = false
}
}
}
task grantAlfaAnimationPermissions(type: Exec, dependsOn: "installAlfaDebug") {
group = 'permission'
description = 'Grant permissions for testing.'
def absolutePath = file('..') // Get project absolute path
commandLine "$absolutePath/set_animation_permissions.sh $alfaApplicationIdName".split(" ")
}
task grantProductionAnimationPermissions(type: Exec, dependsOn: "installProductionDebug") {
group = 'permission'
description = 'Grant permissions for testing.'
def absolutePath = file('..') // Get project absolute path
commandLine "$absolutePath/set_animation_permissions.sh $applicationIdName".split(" ")
}
//https://discuss.kotlinlang.org/t/org-jetbrains-annotations-notnull-problem-with-android-build/629/5
task cleanAnnotationsJar(type:Jar, dependsOn:configurations.cleanedAnnotations) {
archiveName = "annotations-cleaned.jar"
exclude 'org/jetbrains/annotations/NotNull.class'
exclude 'org/jetbrains/annotations/Nullable.class'
doFirst {
configurations.cleanedAnnotations.each { f ->
project.logger.debug("Found ${f} in cleanedAnnotations")
from zipTree(f)
}
}
}
// Source: http://stackoverflow.com/q/29908110/112705
afterEvaluate {
// When launching individual tests from Android Studio, it seems that only the assemble tasks
// get called directly, not the install* versions
tasks.each { task ->
if (task.name.startsWith("assembleAlfaDebugAndroidTest")) {
task.dependsOn grantAlfaAnimationPermissions
}
if (task.name.startsWith("assembleProductionDebugAndroidTest")) {
task.dependsOn grantProductionAnimationPermissions
}
}
}
最佳答案
在加载的 Kotlin 包中排除 annotations
模块对我有用。但是,您在这里使用了多个 Kotlin 版本:
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation("org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion") {
exclude group: 'org.jetbrains', module: 'annotations'
}
我建议也排除非 jre7
版本中的注释:
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"{
exclude group: 'org.jetbrains', module: 'annotations'
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion") {
exclude group: 'org.jetbrains', module: 'annotations'
}
干净的构建也可以解决各种缓存错误。如果这不起作用,我建议您检查项目的先前版本,其中 gradle 构建过程没有失败,并逐步包含新的依赖项。使用这种方法,您可以轻松找到冲突的包。
关于android - 多个dex文件定义Lorg/intellij/lang/annotations/JdkConstants$CursorType,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47814758/
Error:Error converting bytecode to dex: Cause: com.android.dex.DexException: Multiple dex files defi
我试图在 avd 中运行我的应用程序,但是当我选择运行 gradle 时出现异常: Error:Error converting bytecode to dex: Cause: com.android
当我提取一个文件 aab 时出现这个错误: Invalid dex file indices, expecting file 'classes٢.dex' but found 'classes2.de
我有一个 ionic 项目。它已成功构建并在我的 android 手机中运行。突然有一天,当我运行命令“ionic cordova run android”时,我得到如下构建错误: Dex: Erro
这个问题在这里已经有了答案: Unable to execute dex: Multiple dex files define (31 个回答) 4年前关闭。 我更新了 android studio
从过去 3 天开始,我遇到了这个错误,并且已经尽了我所能。任何人都可以帮我纠正它。我正在使用 Android 3.0,我的 sdk 和 Google Play 服务已更新,并且我已将 multiDex
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.nnroh.debtmanager, PI
好的,现在我真的被困在这里了。我不知道该做什么,去哪里或任何事情! 我一直在尝试卸载、重新安装 SDK 和 Eclipse 版本,尝试用谷歌搜索出来,但是 nu-uh... 什么都没有!!! 我可以在
怎么了?为什么我有这个问题? Unable to execute dex: Multiple dex files define Lcom/nineoldandroids/animation/Anima
我尝试运行我的 android 应用程序,但出现此错误。 [2014-03-11 11:21:34 - Dex Loader] Unable to execute dex: Multiple dex
我希望指定包中的所有类都驻留在主 dex 文件中。 那里有使用通配符的选项吗? 最佳答案 很遗憾,不支持通配符。 但是,您可以使用 this script 生成 main-dex-list 文件。 .
我目前有一个来自霍尼韦尔的 DEX BLE-1 适配器,用于从自动售货机检索 dex 数据。我有一个 swift 3 iOS 应用程序,它使用 CoreBluetooth 进行扫描并与外围设备配对。该
我正在使用 IntelliJ IDEA 12.1.4,在我的项目中我使用了几个库/项目: ActionBarSherlock ViewPagerIndicator Volley ProgressShe
我在尝试运行我的项目时遇到了这个问题 - com.android.builder.dexing.DexArchiveBuilderException: Failed to process .gradl
我一直在四处寻找,有很多帖子与这个问题有关,但似乎没有确定的解决方案(例如 Error when building apk - "Multiple dex files define Lcom/goog
我正在对 Jan Berkel 的 SBT Android 插件进行一些黑客攻击,我在想是否有一种方法可以将多个 .dex 文件合并到一个 .dex 文件中包含所有这些。 例如,如果我有这个: cla
我在尝试运行我的应用程序时遇到了这些问题,但不知道如何解决... 谁能帮帮我 这是错误: [2014-04-18 18:47:35 - Dex Loader] Unable to execute de
这个问题在这里已经有了答案: Android support multidex library implementation (4 个回答) 4年前关闭。 生成签名的apk时,有这个错误,但构建项目是
我有一个 Android 应用程序,(理论上)它可以变成一个库并放入外部应用程序中。然后外部应用程序可以创建一个包含我的应用程序的选项卡。库应用程序的设置方式与 google-play-service
我正在开发一个 android 应用程序并且 gradle 构建工作正常但是现在当我构建我的 android 项目时,gradle 构建失败并显示以下错误 Error converting bytec
我是一名优秀的程序员,十分优秀!