应用程序与ProGuard崩溃

时间:2015-11-07 16:58:39

标签: java android android-studio proguard

当我使用minifyEnabled true时,我的应用程序崩溃了。我的build.gradle:

apply plugin: 'com.android.application'

android {
signingConfigs {
    config {
        keyAlias 'myName'
        keyPassword 'myPass'
        storeFile file('.jks path')
        storePassword 'myPass'
    }
}
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
    applicationId "com.user.android.myapp"
    minSdkVersion 15
    targetSdkVersion 22
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:support-v4:22.2.1'
}
repositories {
maven {
    url 'http://repository.adbuddiz.com/maven'
    }
}

我的prguard档案:

-dontwarn com.squareup.okhttp.**
-keep class android.support.v4.app.** { *; }
-keep interface android.support.v4.app.** { *; }

logcat输出:

E/AndroidRuntime: FATAL EXCEPTION: main
E/AndroidRuntime: Process: com.user.android.myapp, PID: 16626
E/AndroidRuntime: java.lang.NullPointerException: Attempt to get length of     null array
E/AndroidRuntime:     at     com.user.android.myapp.activities.b.getCount(Unknown Source)
E/AndroidRuntime:     at     android.widget.ListView.setAdapter(ListView.java:487)
E/AndroidRuntime:     at com.user.android.myapp.b.a.f.a(Unknown Source)
E/AndroidRuntime:     at com.user.android.myapp.b.a.f.onPostExecute(Unknown     Source)
E/AndroidRuntime:     at android.os.AsyncTask.finish(AsyncTask.java:632)
E/AndroidRuntime:     at android.os.AsyncTask.access$600(AsyncTask.java:177)
E/AndroidRuntime:     at     android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
E/AndroidRuntime:     at     android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime:     at     android.app.ActivityThread.main(ActivityThread.java:5349)
E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime:     at     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
E/AndroidRuntime:     at         com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

*没有ProGuard,应用程序没有崩溃

0 个答案:

没有答案