Android Studio Multidex失败:堆栈映射框中的验证类型[73]未知

时间:2016-10-11 09:24:15

标签: android android-studio multidex android-multidex

我使用Multidex来解决65535.I已经应用了Android Multidex指南。 https://developer.android.com/tools/building/multidex.html 但任务'执行失败':堆栈映射框中的未知验证类型[73]。 这个类在Android库中我无法修改它。它的jar可能是proguard。 我该如何解决这个问题?

失败:构建因异常而失败。

任务执行失败':XXXXX:transformClassesWithMultidexlistForDebug'。

  

java.io.IOException:无法读取[\ build \ intermediates \ transforms \ jarMerging \ debug \ jars \ 1 \ 1f \ combined.jar](无法处理类[XXXXX.class](未知验证类型) [73]在堆栈图框架中))

这是我的build.gradle:

apply plugin:'com.android.application'

依赖{     编译'com.android.support:multidex:1.0.0'

compile fileTree(include: '*.jar', dir: 'libs')
compile project(':Android_Libproject')
compile files('libs/ant-1.9.5.jar')
compile files('libs/ant-launcher-1.9.5.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/dom4j-1.6.1.jar')
compile files('libs/htmllexer.jar')
...........

}

android {     compileSdkVersion 21     buildToolsVersion“21.1.2”

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

defaultConfig {

    minSdkVersion 19
    targetSdkVersion 21
    multiDexEnabled true
}

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src/main/java','src']
        resources.srcDirs = ['src/main/java','src']
        aidl.srcDirs = ['src/main/java','src']
        renderscript.srcDirs = ['src/main/java','src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    // Move the tests to tests/java, tests/res, etc...
    instrumentTest.setRoot('tests')

    // Move the build types to build-types/<type>
    // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
    // This moves them out of them default location under src/<type>/... which would
    // conflict with src/ being used by the main source set.
    // Adding new build types or product flavors should be accompanied
    // by a similar customization.
    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
}

}

2 个答案:

答案 0 :(得分:2)

尝试使用编译'com.android.support:multidex:1.0.1'

还尝试从以下位置扩展Application类:

public class ApplicationWrapper extends MultiDexApplication

答案 1 :(得分:1)

根据错误消息,它很可能来自Proguard(当您启用multi-dex时始终运行)。

如果您的第三方库中包含具有损坏的StackMapTable属性的类,则会发生这种情况 - 请参阅Proguard的错误跟踪器中的similar issue

如果确实如此 - 您最好的选择是通过手动修补Proguard proguard.classfile.ClassConstants#ATTR_StackMapTable字段"dummy"来忽略此错误,如下所示:

public static final String ATTR_StackMapTable = "dummy";

之后,您必须构建Proguard库并告诉Android构建链使用您的修补版本。见Greg Ennis的detailed instructions here

出于好奇,您可以共享库名/二进制文件吗?它是专有的还是开源的?