Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing in GifViewUtils #224

Closed
rajattjainn opened this issue Oct 31, 2015 · 4 comments
Closed

Crashing in GifViewUtils #224

rajattjainn opened this issue Oct 31, 2015 · 4 comments

Comments

@rajattjainn
Copy link

Hi,

We're using this library to animate the loading icon for our Android app, and we faced this crash after the latest updated. I wish I could interpret the error better, but I'm posting the error details below.

Fatal Exception: java.lang.RuntimeException: Unable to resume activity {com.holidify.andorid.app.holidify/com.holidify.andorid.app.holidify.ui.SplashActivity}: android.view.InflateException: Binary XML file line #15: Error inflating class pl.droidsonroids.gif.GifTextView
at android.app.ActivityThread.performResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
at android.app.ActivityThread.access$700(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by android.view.InflateException: Binary XML file line #15: Error inflating class pl.droidsonroids.gif.GifTextView
at android.view.LayoutInflater.createView(LayoutInflater.java)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java)
at android.app.Dialog.setContentView(Dialog.java)
at com.holidify.andorid.app.holidify.widgets.CustomProgressDialog.onCreate(CustomProgressDialog.java)
at android.app.Dialog.dispatchOnCreate(Dialog.java)
at android.app.Dialog.show(Dialog.java)
at com.holidify.andorid.app.holidify.widgets.CustomProgressDialog.show(CustomProgressDialog.java)
at com.holidify.andorid.app.holidify.ui.SplashActivity.showProgressDialog(SplashActivity.java)
at com.holidify.andorid.app.holidify.ui.SplashActivity.onResume(SplashActivity.java)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java)
at android.app.Activity.performResume(Activity.java)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
at android.app.ActivityThread.access$700(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java)
at android.app.Dialog.setContentView(Dialog.java)
at com.holidify.andorid.app.holidify.widgets.CustomProgressDialog.onCreate(CustomProgressDialog.java)
at android.app.Dialog.dispatchOnCreate(Dialog.java)
at android.app.Dialog.show(Dialog.java)
at com.holidify.andorid.app.holidify.widgets.CustomProgressDialog.show(CustomProgressDialog.java)
at com.holidify.andorid.app.holidify.ui.SplashActivity.showProgressDialog(SplashActivity.java)
at com.holidify.andorid.app.holidify.ui.SplashActivity.onResume(SplashActivity.java)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java)
at android.app.Activity.performResume(Activity.java)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
at android.app.ActivityThread.access$700(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.NoClassDefFoundError: pl.droidsonroids.gif.R$styleable
at pl.droidsonroids.gif.GifViewUtils.isFreezingAnimation(GifViewUtils.java)
at pl.droidsonroids.gif.GifTextView.init(GifTextView.java)
at pl.droidsonroids.gif.GifTextView.(GifTextView.java)
at java.lang.reflect.Constructor.constructNative(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java)
at android.view.LayoutInflater.createView(LayoutInflater.java)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.rInflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at android.view.LayoutInflater.inflate(LayoutInflater.java)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java)
at android.app.Dialog.setContentView(Dialog.java)
at com.holidify.andorid.app.holidify.widgets.CustomProgressDialog.onCreate(CustomProgressDialog.java)
at android.app.Dialog.dispatchOnCreate(Dialog.java)
at android.app.Dialog.show(Dialog.java)
at com.holidify.andorid.app.holidify.widgets.CustomProgressDialog.show(CustomProgressDialog.java)
at com.holidify.andorid.app.holidify.ui.SplashActivity.showProgressDialog(SplashActivity.java)
at com.holidify.andorid.app.holidify.ui.SplashActivity.onResume(SplashActivity.java)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java)
at android.app.Activity.performResume(Activity.java)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java)
at android.app.ActivityThread.access$700(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.app.ActivityThread.main(ActivityThread.java)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java)
at dalvik.system.NativeStart.main(NativeStart.java)

We are not using Eclipse, but Android Studio. The dependency added in build.gradle is as follows:
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.10'
I have tried using this library with different versions (1.1.3, 1.1.9, etc) but no luck.

Also, this issue is not reproducible in every device. I have been able to reproduce this issue Samsung Galaxy Grand I9082, but not in Motorola G, Generation 1 or 2.

@koral--
Copy link
Owner

koral-- commented Oct 31, 2015

Caused by java.lang.NoClassDefFoundError: pl.droidsonroids.gif.R$styleable
Direct reason is that mentioned class has not been found.
Is that the same APK on both devices?
Do you have custom proguard configuration (I see no line numbers)?

@rajattjainn
Copy link
Author

Yeah, it's the same APK on both the devices.
Also, I have not added any custom proguard configuration.

Later, I found out if I use version 23.0.1 of google support libraries, then the app runs smoothly on all the devices. However if I change the dependency version to 23.1.0, the app crashes on selected devices.

Here is my build.gradle for reference,

buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.19.1'
}

}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {

compileSdkVersion 23
buildToolsVersion '22.0.1'
defaultConfig {
    applicationId "com.xxxx.andorid.app.xxxx"
    minSdkVersion 14
    targetSdkVersion 21
    versionCode 22
    versionName "1.05"
    renderscriptTargetApi 19
    renderscriptSupportModeEnabled true
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}


packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}

}

repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.ms-square:expandableTextView:0.1.3'
compile 'com.android.support:support-annotations:23.0.1'
compile 'com.getbase:floatingactionbutton:1.9.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'org.lucasr.twowayview:twowayview:0.1.0'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.github.bluejamesbond:textjustify-android:2.1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.2.3@aar') {
transitive = true;
}
compile 'com.mcxiaoke.volley:library:1.0.16'
compile files('/libs/Holidify_pojos-0.0.1.jar')
compile files('libs/hibernate-jpa-2.1-api-1.0.0.Final.jar')
apply plugin: 'com.google.gms.google-services'
compile 'com.github.lawloretienne:quickreturn:0.0.1'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.3'
compile 'com.android.support:design:23.0.1'
compile 'com.getbase:floatingactionbutton:1.10.0'

compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.bumptech.glide:glide:3.6.0'
compile 'me.iwf.photopicker:PhotoPicker:0.2.7@aar'

compile('org.apache.httpcomponents:httpmime:4.2.2') {
    // avoid "is ignored for the default configuration X" warnings
    // since httpclient is included in the android SDK.
    exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
compile files('/libs/CleverTapAndroidSDK-v1-20150903.jar')
compile 'com.github.bumptech.glide:glide:3.6.1'

}

@koral--
Copy link
Owner

koral-- commented Nov 3, 2015

I'm not familiar with multidex but it maybe caused by the fact that class pl.droidsonroids.gif.R$styleable is located in different dex file and for some reason is not loaded at the time of exception occurrence.

@koral--
Copy link
Owner

koral-- commented Nov 8, 2015

I was able to reproduce similar issue (differing only by class which was not found). Adding multiDexEnabled true is not enough for multidex feature to work.
You should also add:

It looks like Motorola G has Lollipop which natively supports multidex and does not require support library dependency unlike Galaxy Grand and changing version of support library caused change of number of methods in apk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants