调试版本中的android proguard?

标签 android android-proguard android-debug

我有一个 android 应用程序,它支持 android >= 4。 在调试编译中,它有 > 65k 的方法,因此它是 multidex。 在发布时,我使用 proguard,它有 38k 个方法,并且不是 multidex。 我该如何开发一个在 Debug模式下可能会崩溃的应用程序,仅仅因为它有超过 65k 个方法?

我想我也可以在调试版本中使用 proguard,但没有看到有人这样做 + 使用 proguard 编译会花费更多时间 你会如何处理这种情况?

附言 我的 app.gradle 看起来像这样(依赖部分):

        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')

我使用所有这些库

最佳答案

我在调试版本中使用混淆器。通常我的 build.gradle 看起来像这样:

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

注意用于调试的不同混淆器文件 (proguard-rules-debug.pro) 添加了 -dontobfuscate 选项。

用 proguard 编译它所花费的时间大约长 5-10%,这对我来说是可以接受的。我没有使用即时运行,所以我不知道它是如何受此影响的。

关于调试版本中的android proguard?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36062492/

相关文章:

android - 菜单项不起作用

android - makeSceneTransitionAnimation 不工作

android - 仅使用 Proguard : Could not init DaoConfig => ArrayIndexOutOfBoundsException

android - 使用 HttpResponse 时出现异常 response = client.execute(request);

android - 如何在 Android 应用程序中设置测试标志以区分在测试环境和生产环境中运行该应用程序?

android - 使用参数 'pan' 初始化过滤器 'stereo:c0<c0+c2:c1<c1+c3' 时出错

android - 支持库中的 GridLayout 在 API 16-17 上无法正常工作

java - Proguard混淆错误

android - Dagger2 在应用 ProGuard 规则后提示

android - 如何在未连接到调试器时调试 android 崩溃