Android应用程序在5.0.1以下版本崩溃 - 找不到类

时间:2015-04-26 20:22:28

标签: android android-gradle proguard android-5.0-lollipop classnotfoundexception

我在Android应用程序中使用SweetAlert库和RippleView库。

该应用在使用Android v5.0.2的设备上运行完美,但在使用Android v4.4.2及更低版本的多台设备上崩溃,但以下情况除外:

  

java.lang.RuntimeException:未知的动画名称:   cn.pedant.SweetAlert.Rotate3dAnimation   错误:cn.pedant.SweetAlert.Rotate3dAnimation

  

java.lang.RuntimeException:无法启动活动ComponentInfo {com.sample / com.sample.RegistrationActivity_}:   android.view.InflateException:二进制XML文件行#44:错误   膨胀类com.andexert.library.RippleView

我认为这可能与proguard有关,因为这些类不可见,但即使在禁用ProGuard后,崩溃也会继续。

这是我的build.gradle:

    apply plugin: 'com.android.application'
    apply plugin: 'android-apt'
    def AAVersion = '3.2'

    buildscript {
        repositories {
            mavenCentral()
        }

        dependencies {
            classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
        }
    }

    apt {
        arguments {
            androidManifestFile variant.outputs[0].processResources.manifestFile
            resourcePackageName 'com.sample'
        }
    }

    android {
        compileSdkVersion 21
        buildToolsVersion "21.1.2"

        defaultConfig {
            applicationId "com.sample"
            minSdkVersion 14
            targetSdkVersion 21
            versionCode 1
            versionName "1.0"
            multiDexEnabled = true
        }
        buildTypes {
            release {
                minifyEnabled false
    //            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        apt "org.androidannotations:androidannotations:$AAVersion"
        compile "org.androidannotations:androidannotations-api:$AAVersion"
        compile project(':intercom-sdk-0.9.5')
        compile 'de.greenrobot:eventbus:2.4.0'
        compile 'com.android.support:appcompat-v7:21.0.3'
        compile 'com.edmodo:cropper:1.0.1'
        compile 'com.mobsandgeeks:android-saripaar:1.0.3'
        compile 'cn.pedant.sweetalert:library:1.3'
        compile 'com.github.navasmdc:MaterialDesign:1.+@aar'
        compile 'com.nineoldandroids:library:2.4.0'
        compile 'it.sephiroth.android.library.horizontallistview:hlistview:1.2.2'
        compile 'com.jpardogo.materialtabstrip:library:1.0.9'
        compile 'com.koushikdutta.ion:ion:2.+'
        compile 'com.facebook.android:facebook-android-sdk:3.21.1'
    //    compile 'com.google.android.gms:play-services:6.5.87'
        compile 'org.apmem.tools:layouts:1.8@aar'
        compile 'com.github.traex.rippleeffect:library:1.2.4'
        compile 'com.snappydb:snappydb-lib:0.5.0'
        compile 'com.esotericsoftware.kryo:kryo:2.24.0'
        compile 'com.rockerhieu.emojicon:library:1.0'
        compile 'com.android.support:support-v4:22.0.+'
        compile 'com.google.code.gson:gson:2.3'
        compile 'com.squareup:otto:1.3.6'
        compile 'com.squareup.okhttp:okhttp:2.3.0'
        compile 'com.squareup.retrofit:retrofit:1.9.0'
        compile 'com.squareup.picasso:picasso:2.5.2'
        compile 'com.google.android.gms:play-services:7.0.0'
        compile 'com.facebook.fresco:fresco:0.1.0+'
        compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
    }

堆栈跟踪:

  

java.lang.RuntimeException:未知的动画名称:   cn.pedant.SweetAlert.Rotate3dAnimation   错误:cn.pedant.SweetAlert.Rotate3dAnimation at   cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml(OptAnimationLoader.java:77)             在   cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml(OptAnimationLoader.java:64)             在   cn.pedant.SweetAlert.OptAnimationLoader.createAnimationFromXml(OptAnimationLoader.java:41)             在   cn.pedant.SweetAlert.OptAnimationLoader.loadAnimation(OptAnimationLoader.java:22)             在cn.pedant.SweetAlert.SweetAlertDialog。(SweetAlertDialog.java:80)             在   com.sample.SampleActivity.loginWithFacebook(JoinNeighbourhoodActivity.java:232)             在   com.sample.SampleActivity.processFacebookUser(JoinNeighbourhoodActivity.java:187)             在   com.sample.SampleActivity.access $ 000(JoinNeighbourhoodActivity.java:48)             在   com.sample.SampleActivity $ 1 $ 1.onCompleted(JoinNeighbourhoodActivity.java:138)             在com.facebook.Request $ 1.onCompleted(Request.java:281)at   com.facebook.Request $ 4.run(Request.java:1666)at   android.os.Handler.handleCallback(Handler.java:733)at   android.os.Handler.dispatchMessage(Handler.java:95)at   android.os.Looper.loop(Looper.java:157)at   android.app.ActivityThread.main(ActivityThread.java:5356)at   java.lang.reflect.Method.invokeNative(Native Method)at   java.lang.reflect.Method.invoke(Method.java:515)at   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1265)             在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)             在dalvik.system.NativeStart.main(本地方法)

2 个答案:

答案 0 :(得分:2)

有同样的问题。我通过将其添加到我的Application类

来修复它
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

答案 1 :(得分:0)

问题是由于跨越了功能计数限制。 不得不将应用程序转换为multi-dex。