Szymon Klimaszewski
Szymon Klimaszewski

Reputation: 940

Gradle plugin 1.4.0-beta6 doesn't work with minification and repackageclasses option

Plugin version: com.android.tools.build:gradle:1.4.0-beta6 Build type config:

buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt'
    }
}

minSdkVersion 9
targetSdkVersion 23
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion '23.0.1'

The build cannot be finished because of exception in gradle task. This is extremaly important, because class repackaging fixes many issues on Samsung devices with precompiled support library sources.

Error: :myHeart:transformClassesAndResourcesWithProguardForGooglePlayRelease FAILED

FAILURE: Build failed with an exception.

proguard file:

-repackageclasses 'happy.hacking'

-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }

-keep class android.support.v7.app.** { *; }
-keep interface android.support.v7.app.** { *; }

-keep class android.support.v13.app.** { *; }
-keep interface android.support.v13.app.** { *; }


#To remove debug logs:
-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
    public static *** w(...);
}

-renamesourcefileattribute SourceFile
-keepattributes SourceFile,LineNumberTable

I have filed an issue: https://code.google.com/p/android/issues/detail?id=190386&thanks=190386&ts=1445003690

Upvotes: 1

Views: 312

Answers (2)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

1.4 update to the Android Studio stable release channel. Most of the work and enhancements for Android Studio 1.4 are under the hood.

@Szymon Klimaszewski Trying to use Stable version .

What is Beta Version

A version of a piece of software that is made available for testing.

For your requirement Use 1.4.0-beta4 instead of 1.4.0-beta6 .1.4.0-beta6 is buggy .

Read this article

http://tools.android.com/tech-docs/new-build-system

Upvotes: 1

Szymon Klimaszewski
Szymon Klimaszewski

Reputation: 940

Thanks to IntelliJ Amiya it turned out that 1.4.0-beta6 is buggy, but 1.4.0-beta4 works totally fine.

Upvotes: 1

Related Questions