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

demo混淆后,提示Binary XML file line #24: Binary XML file line #24: Error inflating class LinearLayout #388

Open
5 tasks done
AndryYu opened this issue Dec 29, 2020 · 2 comments

Comments

@AndryYu
Copy link

AndryYu commented Dec 29, 2020

Look at here

  • → Did you conform to the Rules?
  • → Did you read the Wiki Carefully?
  • → Did you search in Google?
  • → Did you search in openned&closed Issues?
  • Receive only bugs and suggestions

Environment

  • MVPArms Version: 2.5.2
  • AndroidStudio Version: 3.6.3
  • Gradle Plugin Version: 5.6.4
  • Target Android Version: Android 10
  • Device Model:三星 S7

Bug Description:

对demo proguard-rules.txt按照module里面的混淆文件配置,并且加上-keep class me.jessyan.mvparms.demo.** { *; }配置。运行demo,提示Binary XML file line #24: Binary XML file line #24: Error inflating class LinearLayout异常。

deBug Description:

  1. 自己项目里面混淆也提示这个问题,并且xml 24 line 没有LinearLayout。
  2. demo里面LinearLayout的闭合是在25line,为了验证错误是否跟LinearLayout 有关,在activity_user.xml中添加了一个Textview控件,移动LinearLayout的位置,但错误提示依旧定位在24 line。

proguard-rules Code:

-optimizationpasses 5

-dontusemixedcaseclassnames

-dontskipnonpubliclibraryclasses

-dontskipnonpubliclibraryclassmembers

-dontpreverify

-verbose
-printmapping priguardMapping.txt

-optimizations !code/simplification/artithmetic,!field/,!class/merging/

################common###############

-keep public class * implements com.jess.arms.integration.ConfigModule

#实体类不参与混淆
-keep class com.jess.arms.widget.** { *; } #自定义控件不参与混淆
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator ;
}
-keepnames class * implements java.io.Serializable
-keepattributes Signature
-keep class *.R$ {
;}
-ignorewarnings
-keepclassmembers class *.R$ {
public static ;
}

-keepclasseswithmembernames class * { # 保持native方法不被混淆
native ;
}

-keepclassmembers enum * { # 使用enum类型时需要注意避免以下两个方法混淆,因为enum类的特殊性,以下两个方法会被反射调用,
public static **[] values();
public static ** valueOf(java.lang.String);
}

################support###############
-keep class android.support.** { ; }
-keep interface android.support.
* { ; }
-dontwarn android.support.
*

################alipay###############

-keep class com.alipay.android.app.IAlixPay{;}
-keep class com.alipay.android.app.IAlixPay$Stub{
;}
-keep class com.alipay.android.app.IRemoteServiceCallback{;}
-keep class com.alipay.android.app.IRemoteServiceCallback$Stub{
;}
-keep class com.alipay.sdk.app.PayTask{ public *;}
-keep class com.alipay.sdk.app.AuthTask{ public *;}

################retrofit###############
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions

################butterknife###############
-keep class butterknife.** { ; }
-dontwarn butterknife.internal.
*
-keep class *$$ViewBinder { ; }
-keepclasseswithmembernames class * {
@ButterKnife.
;
}
-keepclasseswithmembernames class * {
@ButterKnife.
;
}

################gson###############
-keepattributes Signature
-keepattributes Annotation
-keep class sun.misc.Unsafe { ; }
-keep class com.google.gson.stream.
* { *; }

Application classes that will be serialized/deserialized over Gson

-keep class com.sunloto.shandong.bean.** { *; }

################glide###############
-keep public class * implements com.bumptech.glide.module.AppGlideModule
-keep public class * implements com.bumptech.glide.module.LibraryGlideModule
-keep class com.bumptech.glide.** { ; }
-keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$
* {
**[] $VALUES;
public *;
}

################okhttp###############
-keepattributes Signature
-keepattributes Annotation
-keep class com.squareup.okhttp.** { ; }
-keep interface com.squareup.okhttp.
* { ; }
-keep class okhttp3.
* { ; }
-keep interface okhttp3.
* { ; }
-dontwarn com.squareup.okhttp.
*

################androidEventBus###############
-keep class org.simple.** { ; }
-keep interface org.simple.
* { *; }
-keepclassmembers class * {
@org.simple.eventbus.Subscriber ;
}
-keepattributes Annotation

################EventBus###############
-keepclassmembers class * {
@org.greenrobot.eventbus.Subscribe ;
}
-keep class org.greenrobot.eventbus.EventBus { *; }
-keep enum org.greenrobot.eventbus.ThreadMode { *; }

-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
(java.lang.Throwable);
}

################autolayout###############
-keep class com.zhy.autolayout.** { ; }
-keep interface com.zhy.autolayout.
* { *; }

################RxJava and RxAndroid###############
-dontwarn org.mockito.**
-dontwarn org.junit.**
-dontwarn org.robolectric.**

-keep class io.reactivex.** { ; }
-keep interface io.reactivex.
* { *; }

-keepattributes Signature
-keepattributes Annotation
-keep class com.squareup.okhttp.** { ; }
-dontwarn okio.
*
-keep interface com.squareup.okhttp.** { ; }
-dontwarn com.squareup.okhttp.
*

-dontwarn io.reactivex.**
-dontwarn retrofit.**
-keep class retrofit.** { ; }
-keepclasseswithmembers class * {
@retrofit.http.
;
}

-keep class sun.misc.Unsafe { *; }

-dontwarn java.lang.invoke.*

-keep class io.reactivex.schedulers.Schedulers {
public static ;
}
-keep class io.reactivex.schedulers.ImmediateScheduler {
public ;
}
-keep class io.reactivex.schedulers.TestScheduler {
public ;
}
-keep class io.reactivex.schedulers.Schedulers {
public static ** test();
}
-keepclassmembers class io.reactivex.internal.util.unsafe.ArrayQueueField* {
long producerIndex;
long consumerIndex;
}
-keepclassmembers class io.reactivex.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
long producerNode;
long consumerNode;
}

-keepclassmembers class io.reactivex.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
io.reactivex.internal.util.atomic.LinkedQueueNode producerNode;
}
-keepclassmembers class io.reactivex.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
io.reactivex.internal.util.atomic.LinkedQueueNode consumerNode;
}

-dontwarn io.reactivex.internal.util.unsafe.**

################espresso###############
-keep class android.support.test.espresso.** { ; }
-keep interface android.support.test.espresso.
* { *; }

################annotation###############
-keep class android.support.annotation.** { ; }
-keep interface android.support.annotation.
* { *; }

################RxLifeCycle#################
-keep class com.trello.rxlifecycle2.** { ; }
-keep interface com.trello.rxlifecycle2.
* { *; }

################RxPermissions#################
-keep class com.tbruyelle.rxpermissions2.** { ; }
-keep interface com.tbruyelle.rxpermissions2.
* { *; }

################RxCache#################
-dontwarn io.rx_cache2.internal.**
-keep class io.rx_cache2.internal.Record { *; }
-keep class io.rx_cache2.Source { *; }

-keep class io.victoralbertos.jolyglot.** { ; }
-keep interface io.victoralbertos.jolyglot.
* { *; }

################RxErrorHandler#################
-keep class me.jessyan.rxerrorhandler.** { ; }
-keep interface me.jessyan.rxerrorhandler.
* { *; }

################Timber#################
-dontwarn org.jetbrains.annotations.**

################Canary#################
-dontwarn com.squareup.haha.guava.**
-dontwarn com.squareup.haha.perflib.**
-dontwarn com.squareup.haha.trove.**
-dontwarn com.squareup.leakcanary.**
-keep class com.squareup.haha.** { ; }
-keep class com.squareup.leakcanary.
* { *; }

Marshmallow removed Notification.setLatestEventInfo()

-dontwarn android.app.Notification

不混淆demo代码

-keep class me.jessyan.mvparms.demo.** { *; }

Bug Log:

2020-12-29 16:35:07.682 15617-15617/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: me.jessyan.mvparms.demo, PID: 15617
java.lang.RuntimeException: Unable to start activity ComponentInfo{me.jessyan.mvparms.demo/me.jessyan.mvparms.demo.mvp.ui.activity.UserActivity}: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class LinearLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2917)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2978)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1628)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6646)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
Caused by: android.view.InflateException: Binary XML file line #24: Binary XML file line #24: Error inflating class LinearLayout
Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class LinearLayout
Caused by: java.lang.NullPointerException: throw with null exception
at com.jess.arms.d.i.a()
at com.jess.arms.base.c.onCreateView(:89)
at android.app.Activity.onCreateView(Activity.java:6062)
at androidx.fragment.app.b.onCreateView(:338)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:784)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:2172)
at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2777)
at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2850)
at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2160)
at androidx.appcompat.app.AppCompatDelegateImpl.z(:717)
at androidx.appcompat.app.AppCompatDelegateImpl.A(:659)
at androidx.appcompat.app.AppCompatDelegateImpl.c(:552)
at androidx.appcompat.app.d.setContentView(:161)
at com.jess.arms.base.c.onCreate(:100)
at android.app.Activity.performCreate(Activity.java:6912)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2870)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2978)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1628)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6646)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

Others:

@Jay-ch
Copy link

Jay-ch commented Jun 3, 2021

同问,刚刚遇到同样的问题,签名打正式包就报这个错,debug不报错

@JessYanCoding
Copy link
Owner

#358

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

3 participants