【问题标题】:Android - Transform Classes With Multidexlist For Debug - Instagram JSON ParserAndroid - 使用 Multidexlist 转换类以进行调试 - Instagram JSON 解析器
【发布时间】:2017-05-05 21:16:48
【问题描述】:

我正在尝试编译和部署我的 Android 应用程序,但我遇到了 MultiDex 问题:

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.lang.UnsupportedOperationException (no error message)

我已经尝试了很多修复,但它们都不起作用。

我已经尝试过的:

1. multiDexEnabled true

2. dexOptions

dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
}

3. 在 Android Studio 设置中关闭 Instant Run

4. 重启 Android Studio 和电脑。

5. 清除重建项目。

6. 文件 > 使缓存无效/重新启动

7. 编译 'com.android.support:multidex:1.0.1' [编辑]

终于重新开始了我的生活,但什么都不想工作..

可以做些什么来解决这个问题?

这是我的 Gradle 文件

buildscript {
    repositories {
        mavenCentral()
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'

android {
    compileSdkVersion 23
    buildToolsVersion '24.0.1'

    defaultConfig {
        applicationId "com.X.Y"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 90
        versionName "1.2.3"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    packagingOptions {
        exclude 'META-INF/DEPENDENCIES.txt'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
        exclude 'META-INF/dependencies.txt'
        exclude 'META-INF/LGPL2.1'
    }
}

repositories {
    jcenter()
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'https://dl.bintray.com/X/maven/' }
    maven { url "https://jitpack.io" }
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.0.1'
    // Utils
    //ANR Helper & Memory Leaks helper
    //compile 'com.github.anrwatchdog:anrwatchdog:1.1.+'
    //compile 'com.squareup.leakcanary:leakcanary-android:1.4-beta2'
    // HoneyWell sdk
    compile files('libs/honeywell.jar')
    // RealmAdapter
    compile 'io.realm:android-adapters:1.2.1'
    // Volley
    compile 'com.mcxiaoke.volley:library:1.0.19'
    // EventBus
    //    compile 'org.greenrobot:eventbus:3.0.0'
    // Gson
    compile 'com.google.code.gson:gson:2.3.1'
    // Jjp
    compile 'com.instagram:ig-json-parser-processor:0.0.6+'
    // Sticky List headers
    compile 'se.emilsjolander:stickylistheaders:2.7.0'
    // Parallax
    compile 'com.github.nirhart:parallaxscroll:1.0'
    // Facebook
    compile 'com.facebook.android:facebook-android-sdk:4.6.0'
    // Zbar
    compile 'me.dm7.barcodescanner:zbar:1.9'
    // NumberProgressBar
    compile 'com.daimajia.numberprogressbar:library:1.2@aar'
    // AutoFitTextView
    compile 'me.grantland:autofittextview:0.2.+'
    // RoundedImageView
    compile 'com.makeramen:roundedimageview:2.2.0'
    // UpdateChecker
    compile 'com.github.rampo.updatechecker:library:2.1.8'
    // UniversalImageLoader
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
    // GifDrawable
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
    // PieChart
    compile 'com.github.PhilJay:MPAndroidChart:v2.2.4'
    compile 'com.android.support:support-v13:+'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }
    //AndroidSlidingUpPanel
    compile 'com.sothree.slidinguppanel:library:3.3.0'
    // YPL
    compile 'com.X:Xandroidlibrary:1.4.0'
    compile project(':kdcreader')
}

这里是 Gradle 控制台

执行任务:[:app:assembleDebug]

按需配置是一项孵化功能。警告: 警告: 依赖 org.apache.httpcomponents:httpclient:4.3.5 被忽略 调试,因为它可能与提供的内部版本冲突 安卓。 如果出现问题,请用jarjar重新打包以更改类包WARNING:WARNING:Dependency org.apache.httpcomponents:httpclient:4.3.5 被忽略以进行调试,因为它 可能与安卓提供的内部版本有冲突。 如果出现问题,请用jarjar重新打包以更改类包WARNING:WARNING:Dependency org.apache.httpcomponents:httpclient:4.3.5 被忽略为发布 可能与安卓提供的内部版本有冲突。 如果出现问题,请用jarjar重新打包以更改类包WARNING:WARNING:Dependency org.apache.httpcomponents:httpclient:4.3.5 被忽略为发布 可能与安卓提供的内部版本有冲突。 如有问题,请用jarjar重新打包以更改类包 :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE :app:preDebugAndroidTestBuild UP-TO-DATE :app:prepareComAndroidSupportMultidex101Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72330Library UP-TO-DATE :app:prepareComAndroidSupportSupportCompat2510Library UP-TO-DATE :app:prepareComAndroidSupportSupportCoreUi2510Library UP-TO-DATE :app:prepareComAndroidSupportSupportCoreUtils2510Library UP-TO-DATE :app:prepareComAndroidSupportSupportFragment2510Library UP-TO-DATE :app:prepareComAndroidSupportSupportMediaCompat2510Library UP-TO-DATE :app:prepareComAndroidSupportSupportV132510Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42510Library UP-TO-DATE :app:prepareComCrashlyticsSdkAndroidAnswers136Library UP-TO-DATE :app:prepareComCrashlyticsSdkAndroidBeta114Library UP-TO-DATE :app:prepare ComCrashlyticsSdkAndroidCrashlytics255Library UP-TO-DATE :app:prepare ComCrashlyticsSdkAndroidCrashlyticsCore238Library UP-TO-DATE :app:prepareComDaimajiaNumberprogressbarLibrary12Library 最新:app:prepareComFacebookAndroidFacebookAndroidSdk460Library 最新:app:prepareComGetkeepsafeRelinkerRelinker122Library 最新:app:prepareComGithubNirhartParallaxscroll10Library 最新:app:prepareComGithubRampoUpdatecheckerLibrary218Library 最新:app:prepareComMakeramenRoundedimageview220Library 最新:app:prepareComSothreeSlidinguppanelLibrary330Library 最新:app:prepareComXXnandroidlibrary140Library 最新:app:prepareIoFabricSdkAndroidFabric1310图书馆最新 :app:prepareIoRealmAndroidAdapters121Library UP-TO-DATE :app:prepareIoRealmRealmAndroidLibrary211Library UP-TO-DATE :app:prepareMeDm7BarcodescannerCore19Library UP-TO-DATE :app:prepareMeDm7BarcodescannerZbar19Library UP-TO-DATE :app:prepareMeGrantlandAutofittextview021图书馆最新 :app:preparePlDroidsonroidsGifAndroidGifDrawable1117Library UP-TO-DATE :app:prepareSeEmilsjolanderStickylistheaders270Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl 最新 :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig 最新:app:mergeDebugShaders 最新:app:compileDebugShaders 最新:app:generateDebugAssets 最新:app:mergeDebugAssets 最新:app:processDebugManifest 最新 :app:fabricGenerateResourcesDebug :app:generateDebugResValues 最新:app:generateDebugResources:app:mergeDebugResources :app:processDebugResources :app:generateDebugSources :app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE :app:compileDebugJavaWithJavac 最新 :app:compileDebugNdk 最新:app:compileDebugSources 最新 :app:transformClassesWithRealmTransformerForDebug 最新 :app:transformClassesWithJarMergingForDebug 最新 :app:transformClassesWithMultidexlistForDebug 失败

FAILURE:构建失败并出现异常。

  • 出了什么问题:任务 ':app:transformClassesWithMultidexlistForDebug' 执行失败。

    java.lang.UnsupportedOperationException(无错误消息)

  • 尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。

构建失败

总时间:5.277 秒

[编辑] 以及有关崩溃的更多信息:http://pastebin.com/vG79DLuN

感谢您的帮助!

【问题讨论】:

  • 大声笑为什么那个吻:P
  • @Charuka 获得更多帮助 xD
  • 首先尝试通过排除 -->stackoverflow.com/a/30460255/5188159 来避免该警告
  • 您是否更改了构建 gradle 中的任何内容?
  • 是的,但只是'X'的应用程序包

标签: java android android-studio android-gradle-plugin android-multidex


【解决方案1】:

我也有同样的问题。在我的应用程序中,我使用的是 guava-retrying 库,它正在获取 google guava library version 21。 Guava 版本 21 需要 JDK 1.8,但不提供反向移植支持,这在我的情况下导致了此错误。

我能够通过包含 guava-retrying 库来解决它,以便它使用 19.0 版的 guava 库:

compile ("com.github.rholder:guava-retrying:2.0.0") {
    exclude group: 'com.google.guava', module: 'guava'
}
compile 'com.google.guava:guava:19.0'

【讨论】:

  • 经过一些检查,有一个依赖破坏了我的项目:compile 'com.instagram:ig-json-parser-processor:0.0.6+'
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-04-27
  • 1970-01-01
  • 1970-01-01
  • 2020-04-02
  • 1970-01-01
  • 1970-01-01
  • 2014-11-08
相关资源
最近更新 更多