CircleImageView: Error: android.view.InflateException: Binary XML file line #28: Error inflating class de.hdodenhof.circleimageview.CircleImageView

Hi, Thank you for your project ^^;

I found an crash. I just add [compile ‘com.google.android.gms:play-services-analytics:8.3.0’] in my gradle, and add code in my main activity. however, if I delete that code my app is ok.

this is my build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'


android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"



    defaultConfig {
        applicationId "com.xxx.xxx"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 152
        versionName "4.4.1"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    /*productFlavors {
        dev {
            minSdkVersion 15
        }
        prod {
            minSdkVersion 15
        }
    }*/
}



dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:23.1.0'           //Support Library
    compile 'com.android.support:cardview-v7:23.1.0'            //CardView Library
    compile 'com.android.support:gridlayout-v7:23.1.0'          //GridLayout Library
    compile 'com.android.support:recyclerview-v7:23.1.0'
    compile 'com.android.support:palette-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'                 //Design Support Library

    compile 'com.github.rey5137:material:1.2.1'                 //Material Design Support/ https://github.com/rey5137/material

    compile 'com.squareup.retrofit:retrofit:1.9.0'              //Network Library
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
    compile 'com.github.bumptech.glide:glide:3.6.1'             //Network Image Library/    https://github.com/bumptech/glide
    compile 'com.github.bumptech.glide:okhttp-integration:1.3.1'
    compile 'com.squareup.okhttp:okhttp:2.5.0'                  //Network Client/           http://square.github.io/okhttp/

    compile 'de.hdodenhof:circleimageview:2.0.0'                //Circle Image             https://github.com/hdodenhof/CircleImageView

    compile 'com.facebook.android:facebook-android-sdk:4.1.0'   //facebook sdk

    compile 'com.google.android.gms:play-services-analytics:8.3.0'
}

and my Application.java

 private Tracker tracker;

    synchronized public Tracker getDefaultTracker() {
        if (tracker == null) {
            GoogleAnalytics analytics = GoogleAnalytics.getInstance(this);
            tracker = analytics.newTracker(R.xml.global_tracker);
        }

        return tracker;
    }

and my MainActivity.java

Application application = (Application) getApplication();
        Tracker tracker = application.getDefaultTracker();
        tracker.setScreenName(MainActivity.class.getName());
        tracker.send(new HitBuilders.ScreenViewBuilder().build());

and than Exception message

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.xxx/com.xxx.xxx.activity.MainActivity}: android.view.InflateException: Binary XML file line #28: Error inflating class de.hdodenhof.circleimageview.CircleImageView
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2067)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2092)
    at android.app.ActivityThread.access$600(ActivityThread.java:138)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1203)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4874)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #28: Error inflating class de.hdodenhof.circleimageview.CircleImageView
    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    at android.view.LayoutInflater.parseInclude(LayoutInflater.java:830)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:256)
    at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
    at com.xxx.xxx.activity.MainActivity.onCreate(MainActivity.java:96)
    at android.app.Activity.performCreate(Activity.java:5008)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2031)
    ... 11 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.constructNative(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
    ... 28 more
Caused by: java.lang.NoClassDefFoundError: de.hdodenhof.circleimageview.R$styleable
    at de.hdodenhof.circleimageview.CircleImageView.<init>(CircleImageView.java:71)
    at de.hdodenhof.circleimageview.CircleImageView.<init>(CircleImageView.java:65)
    ... 31 more

thank you,

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 22 (1 by maintainers)

Most upvoted comments

I have some way to fix this problem. Why this problem is coming.

  1. problem. This article explain we have method more than 65k.
  2. how to fix.
  3. how to fix if we use google analytic. I hope this realy helpful. sorry for my bad english.

I just remove android:scaleType=“fitCenter” from imageview xml and its working fine now.

Same here !, Any Fix ?

In my case it was just wrong placing an icon image! when I pasted it to drawable, I didn’t notice “…/drawable-v21” in the confirm dialog. AndroidStudio was just keep repeating “Error inflating class de.hdodenhof.circleimageview.CircleImageView”. It takes about 2 hours for me to find it! Anyway…

For Android Studio 3.0.1

I have got the same issue and I have resolved finally Opening the gradle.properties and added following line:

android.enableAapt2=false

It’s been almost half a year and it’s still an issue