android - 如何在 android studio gradle 中降级 proguard 版本?

标签 android scala intellij-idea proguard android-gradle-plugin

我正在尝试使用 scala 和 android studio 构建一个 android 应用程序。 proguard 编译失败,出现异常:

Error:java.lang.ArrayIndexOutOfBoundsException: 4
    at proguard.classfile.editor.InterfaceDeleter.visitSignatureAttribute(InterfaceDeleter.java:162)
    at proguard.classfile.attribute.SignatureAttribute.accept(SignatureAttribute.java:97)

我在另一个地方 ( http://sourceforge.net/p/proguard/bugs/549/ ) 发现这个问题是由 scala 中的一个错误引起的,但它只发生在 proguard 5.1 而不是在 proguard 5.0 中。

现在我的问题是:如何设置 android studio 以便它使用 proguard 5.0?

最佳答案

找到了!

诀窍是在顶层构建文件中排除 proguard 5.1,并改为添加对 5.0 的依赖。

这是我的顶级构建文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath ('com.android.tools.build:gradle:1.0.0') {
            exclude module: 'proguard-gradle'
        }
        classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.3.1"
        classpath ('net.sf.proguard:proguard-gradle:5.0') {
            force = true
        }

    }
}

allprojects {
    repositories {
        jcenter()
    }
}

关于android - 如何在 android studio gradle 中降级 proguard 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27548989/

相关文章:

android - 转换内容 ://URI to actual path for Android using React-Native

android - Codenameone Google Play 警告 : SSL Error Handler Vulnerability

Scala Packrat 解析器、错误消息和引用透明性

json - 带有桑格利亚汽酒的 GraphQL 模式

java - 确保具有特定注释的字段为 'private'

android - OnBackPressed(软键盘打开)

android - 如何从 Kotlin 异步闭包保存数据?

java - 如何从 sbt 中发现定义类的库?

android - 如何在设备重启后立即将调试器附加到服务或应用程序?

scala - 在 IntelliJ IDEA 中找不到 SBT-shell