Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android proguard in debug builds?

I have an android app, which supports android >= 4. In debug compilation it has > 65k methods, thus it is multidex. In release, I use proguard, and it has 38k methods, and is not multidex. How would I develop an app, which in debug mode can crash, just beacuse it is over 65k methods?

I thing I can use proguard in debug builds too, but didn't see anyone doing it + it would take much more time on compilation, using proguard How would you handle this situation?

PS my app.gradle looks like this (dependency's section):

        compile project(':signalr-client-sdk-android')
        compile fileTree(include: ['*.jar'], dir: 'libs')

        compile 'com.android.support:recyclerview-v7:+'
        compile "com.nostra13.universalimageloader:universal-image-loader:${UNIVERSAL_IMAGE_LOADER}"
        compile "de.hdodenhof:circleimageview:${CIRCLE_IMAGE_VER}"
        compile "com.pixplicity.multiviewpager:library:${MULTIVIEW_PAGER_VER}"
        compile "com.michaelpardo:activeandroid:${ACTIVE_ANDROID_VER}"
        compile "com.squareup.okhttp:okhttp:${OKHTTP_VER}"
        compile "com.rockerhieu.emojicon:library:${EMOJI_VERSION}"
        compile "com.facebook.android:facebook-android-sdk:${FACEBOOK_SDK_VER}"
        compile "com.makeramen:roundedimageview:${ROUNDED_IMAGEVIEW_VER}"
        compile 'com.github.orangegangsters:swipy:1.2.0@aar'

        compile "com.google.android.gms:play-services-gcm:${GSM_VER}"
        compile "com.google.android.gms:play-services-analytics:${ANALITICS_VER}"

        compile "com.flurry.android:analytics:${FLURRY_VER}"

        compile 'com.supersonic.sdk:mediationsdk:6.3.6@jar'

        //effects apng tool
        compile project(':android_api')
        compile project(':flingCards')

        compile files('libs/protobuf-java-2.6.1.jar')

And I use all of this libs

like image 627
Anton Kizema Avatar asked Mar 13 '23 21:03

Anton Kizema


1 Answers

I use proguard in debug builds. Usualy my build.gradle looks like this:

    buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-debug.pro'
    }
}

Notice the different proguard file (proguard-rules-debug.pro) for debug which has -dontobfuscate option added.

The time it takes to compile it with proguard is about 5-10% longer which is acceptable to me. I'm not using instant run so I don't know how it's affected by this.

like image 181
vladimir123 Avatar answered Mar 15 '23 11:03

vladimir123