0
java.lang.RuntimeException: Unable to start activity ComponentInfo{muhammad.ibrahim.alkady.al_quran_al_kareem.radio/muhammad.ibrahim.alkady.al_quran_al_kareem.radio.activities.MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #126: Binary XML file line #126: Error inflating class muhammad.ibrahim.alkady.al_quran_al_kareem.radio.widget.MiniMediaController
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5461)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #126: Binary XML file line #126: Error inflating class muhammad.ibrahim.alkady.al_quran_al_kareem.radio.widget.MiniMediaController
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:740)
at android.view.LayoutInflater.inflate(<Xposed>)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.a.ag.b(Unknown Source)
at android.support.v7.a.u.setContentView(Unknown Source)
at muhammad.ibrahim.alkady.al_quran_al_kareem.radio.activities.MainActivity.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
t android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5461) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132) 
Caused by: android.view.InflateException: Binary XML file line #126: Binary XML file line #126: Error inflating class muhammad.ibrahim.alkady.al_quran_al_kareem.radio.widget.MiniMediaController
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method)
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:740)
at android.view.LayoutInflater.inflate(<Xposed>)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at muhammad.ibrahim.alkady.al_quran_al_kareem.radio.fragments.MainFragment.a(Unknown Source)
at android.support.v4.b.u.b(Unknown Source)
at android.support.v4.b.ag.a(Unknown Source)
at android.support.v4.b.ag.b(Unknown Source)
at android.support.v4.b.ag.a(Unknown Source)
at android.support.v4.b.ag.a(Unknown Source)
at android.support.v4.b.ac.a(Unknown Source)
at android.support.v4.b.x.a(Unknown Source)
at android.support.v4.b.s.onCreateView(Unknown Source)
at android.support.v4.b.x.onCreateView(Unknown Source)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:754)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at de.robv.android.xposed.XposedBridge.invokeOriginalMethodNative(Native Method) 
at de.robv.android.xposed.XposedBridge.handleHookedMethod(XposedBridge.java:740) 
at android.view.LayoutInflater.inflate(<Xposed>) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
at android.support.v7.a.ag.b(Unknown Source) 
at android.support.v7.a.u.setContentView(Unknown Source) 
at muhammad.ibrahim.alkady.al_quran_al_kareem.radio.activities.MainActivity.onCreate(Unknown Source) 
at android.app.Activity.performCreate(Activity.java:6251) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5461) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132) 
Caused by: android.view.InflateException: Binary XML file line #126: Error inflating class muhammad.ibrahim.alkady.al_quran_al_kareem.radio.widget.MiniMediaController
at android.view.LayoutInflater.createView(LayoutInflater.java:628)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
at android.view.Layout

build.gradle

    apply plugin: 'com.android.application'
apply plugin: 'android-apt'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "muhammad.ibrahim.alkady.al_quran_al_kareem.radio"
        minSdkVersion 21
        targetSdkVersion 24
        versionCode 10
        versionName "1.9"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies { compile fileTree(include: ['*.jar'], dir: 'libs')
    apt 'com.jakewharton:butterknife-compiler:8.1.0'
    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.jakewharton:butterknife:8.1.0'
    compile 'com.google.android.exoplayer:exoplayer:r1.5.9'
    compile 'com.android.support:support-v4:24.0.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'jp.wasabeef:recyclerview-animators:2.2.3'
    compile 'com.sothree.slidinguppanel:library:3.3.0'
    compile('com.afollestad:sectioned-recyclerview:0.2.2') {
        transitive = true
    }
    compile('com.mikepenz:aboutlibraries:5.7.0@aar') {
        transitive = true
    }
}

This exception only raised in signed apk. When installing unsigned apk no errors raised.From searching it seems the solution is to modify the proguard-rules.pro but unfortunately I do not know how to do this.Help please. Thanks

  • I guess, proguard is changing your class name. Try using the below line in your proguard. `-keepnames class muhammad.ibrahim.alkady.al_quran_al_kareem.radio.*` – sha Jul 03 '16 at 23:10
  • Unfortunately still gives InflateException. –  Jul 03 '16 at 23:15
  • Can you show us your proguard file? – sha Jul 03 '16 at 23:19
  • https://drive.google.com/open?id=0B4fTCNyZUCBHS1V1YkxzQVZOMjQ –  Jul 03 '16 at 23:30
  • I can see you are not using any of the default android proguard rules. Can you please copy these default rules into your project and let me know if it fixed your issues? https://android.googlesource.com/platform/sdk/+/master/files/proguard-android.txt – sha Jul 03 '16 at 23:46
  • The error still there. –  Jul 03 '16 at 23:52
  • can you post your gradle file here? – sha Jul 03 '16 at 23:59
  • I can see the property `minifyEnabled false` which means the proguard rules are not applied at all. In that case, you should not see this issue. not sure ... Just try `minifyEnabled true`, this may cause same kind of issues as well for the libraries Butterknife and support – sha Jul 04 '16 at 00:30
  • unfortunately this also did not work but the apk size was reduced about 1 Mb when minifyEnabled true is this normal? –  Jul 04 '16 at 00:46
  • Yes.. Minified enabling will obfuscate your files inside the APK. This adds a bit of security(makes hard to read) and reduces the size .. – sha Jul 04 '16 at 01:40

2 Answers2

0

It looks like the following class has been obfuscated, but is referenced by some layout:

muhammad.ibrahim.alkady.al_quran_al_kareem.radio.widget.MiniMediaController

You can keep it like that:

-keep class muhammad.ibrahim.alkady.al_quran_al_kareem.radio.widget.MiniMediaController

Maybe it is better to keep all view classes in the widget package (together with their public methods):

-keep class muhammad.ibrahim.alkady.al_quran_al_kareem.radio.widget.** extends android.view.View {
   public <methods>;
}
T. Neidhart
  • 6,060
  • 2
  • 15
  • 38
  • I have tried the above but still give me inflateException @ MiniMediaController –  Jul 04 '16 at 13:31
  • I have changed the class constructors to be public (from protected) and it worked with or without the pro-guard above rules any ideas why? –  Jul 04 '16 at 13:41
  • Some rules might only keep public constructors and thus if they are defined to be protected, the rule will not match, but this is just a guess. – T. Neidhart Jul 04 '16 at 13:47
0

Changing the class MiniMediaController constructor from protected to public solves the problem with or without the pro-guard rules.