Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to downgrade proguard version in android studio gradle?

I am trying to build an android app using scala and android studio. The compile fails at proguard with an exception:

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

I found at another place (http://sourceforge.net/p/proguard/bugs/549/) that this issue is caused by a bug in scala, but that it only occurs in proguard 5.1 and not in proguard 5.0.

Now my question is: how can I setup android studio so that it will use proguard 5.0?

like image 866
user114676 Avatar asked Dec 18 '14 14:12

user114676


1 Answers

Found it!

The trick is to exclude proguard 5.1 in the toplevel buildfile, and add a dependency on 5.0 instead.

Here is my toplevel build file:

// 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()
    }
}
like image 180
user114676 Avatar answered Oct 20 '22 18:10

user114676