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

构建.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
    }
}

此异常仅在签名的 apk 中引发。安装未签名的 apk 时没有引发错误。从搜索看来解决方案是修改 proguard-rules.pro 但不幸的是我不知道该怎么做。请帮忙。谢谢

4

2 回答 2

0

看起来以下类已被混淆,但被某些布局引用:

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

你可以这样保持:

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

也许最好将所有视图类保留在小部件包中(连同它们的公共方法):

-keep class muhammad.ibrahim.alkady.al_quran_al_kareem.radio.widget.** extends android.view.View {
   public <methods>;
}
于 2016-07-04T08:34:40.330 回答
0

将类 MiniMediaController 构造函数从 protected 更改为 public 可以解决有或没有 pro-guard 规则的问题。

于 2016-07-04T18:33:22.443 回答