MVPArms icon indicating copy to clipboard operation
MVPArms copied to clipboard

android studio升级到3.6 开启混淆的问题

Open ccominghome opened this issue 4 years ago • 29 comments

Environment

  • [x] MVPArms Version: v2.5.2
  • [x] AndroidStudio Version: v3.6.1
  • [x] Gradle Plugin Version: v5.6.4
  • [x] Target Android Version:Android 10.0
  • [x] Device Model: Samsung s9+

Bug Description:

android studio升级到3.6后,开启混淆会找不到screen_simple这个资源文件,没用mvparms的demo没用这种情况

Bug Log:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.yunma.haitunzhuishu/com.yunma.haitunzhuishu.mvp.ui.activity.MainActivity}: android.view.InflateException: Binary XML file line #24 in android:layout/screen_simple: Binary XML file line #24 in android:layout/screen_simple: Error inflating class LinearLayout at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3448) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076) Caused by: android.view.InflateException: Binary XML file line #24 in android:layout/screen_simple: Binary XML file line #24 in android:layout/screen_simple: Error inflating class LinearLayout Caused by: android.view.InflateException: Binary XML file line #24 in android:layout/screen_simple: Error inflating class LinearLayout Caused by: java.lang.NullPointerException: throw with null exception at com.jess.arms.c.f.a(Unknown Source:3) at com.jess.arms.base.BaseActivity.onCreateView(:86) at android.app.Activity.onCreateView(Activity.java:7013) at androidx.fragment.app.FragmentActivity.onCreateView(:338) at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1069) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:997) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:961) at android.view.LayoutInflater.inflate(LayoutInflater.java:659) at android.view.LayoutInflater.inflate(LayoutInflater.java:534) at android.view.LayoutInflater.inflate(LayoutInflater.java:481) at com.android.internal.policy.DecorView.onResourcesLoaded(DecorView.java:2727) at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:2791) at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:2858) at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:2167) at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(:717) at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(:659) at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(:552) at androidx.appcompat.app.AppCompatActivity.setContentView(:161) at com.jess.arms.base.BaseActivity.onCreate(:97) at android.app.Activity.performCreate(Activity.java:7955) at android.app.Activity.performCreate(Activity.java:7944) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3423) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3595) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2147) at android.os.Handler.dispatchMessage(Handler.java:107) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:7811) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)

ccominghome avatar Mar 05 '20 15:03 ccominghome

混淆和框架没什么关系,可能是 AS3.6问题,回到 AS3.5 应该就可以了,新 AS 版本不兼容老代码,建议给 Google 提这个 Issues

JessYanCoding avatar Mar 06 '20 04:03 JessYanCoding

混淆和框架没什么关系,可能是 AS3.6问题,回到 AS3.5 应该就可以了,新 AS 版本不兼容老代码,建议给 Google 提这个 Issues

我刚开始也是这么认为的,但是试了几个demo,只有用mvparms框架的会有这个问题,其他的都没影响,示例demo也会这样,

ccominghome avatar Mar 06 '20 05:03 ccominghome

我知道,你试试 AS3.5,应该就没问题

JessYanCoding avatar Mar 06 '20 05:03 JessYanCoding

我知道,你试试 AS3.5,应该就没问题

对,3.5没问题

ccominghome avatar Mar 06 '20 05:03 ccominghome

应该是 baseActivity 调用了某行代码,与 AS3.6 不兼容,你可以一行行注释找出哪行的问题。

他报的错,还不是明面上的错误,里面没有一行和 Arms 代码有直接关系,可能是他内部处理上的一些错误,baseActivity 如果调用的一些代码与 AS3.6 不兼容,那说明其他三方库也可能出现这个问题,只是你试的这几个Demo恰好没调这些代码,不一定只是 Arms 有这个问题

JessYanCoding avatar Mar 06 '20 05:03 JessYanCoding

你是不是还在使用 autolayout,看看是不是 BaseActivity#onCreateView 那里的代码报的错,注释掉看看

JessYanCoding avatar Mar 06 '20 05:03 JessYanCoding

你是不是还在使用 autolayout,看看是不是 BaseActivity#onCreateView 那里的代码报的错,注释掉看看

没用,我debug一路看下来跟mvparms没关系,但是我找不到原因,,

ccominghome avatar Mar 06 '20 06:03 ccominghome

我试了下使用 AS 3.6.0 在 proguard-rules.pro 中加入下面的混淆代码,并开启混淆,Arms 的官方 Demo 是可以正常运行的,你可以试试 AS 3.6.0

-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 <fields>;
}

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

-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.* <fields>;
}
-keepclasseswithmembernames class * {
 @butterknife.* <methods>;
}


################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 <methods>;
}
-keepattributes *Annotation*


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

-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
    <init>(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.* <methods>;
}

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

-dontwarn java.lang.invoke.*

-keep class io.reactivex.schedulers.Schedulers {
    public static <methods>;
}
-keep class io.reactivex.schedulers.ImmediateScheduler {
    public <methods>;
}
-keep class io.reactivex.schedulers.TestScheduler {
    public <methods>;
}
-keep class io.reactivex.schedulers.Schedulers {
    public static ** test();
}
-keepclassmembers class io.reactivex.internal.util.unsafe.*ArrayQueue*Field* {
    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

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

JessYanCoding avatar Mar 06 '20 06:03 JessYanCoding

我试了下使用 AS 3.6.0 在 proguard-rules.pro 中加入下面的混淆代码,并开启混淆,Arms 的官方 Demo 是可以正常运行的,你可以试试 AS 3.6.0

-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 <fields>;
}

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

-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.* <fields>;
}
-keepclasseswithmembernames class * {
 @butterknife.* <methods>;
}


################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 <methods>;
}
-keepattributes *Annotation*


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

-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
    <init>(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.* <methods>;
}

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

-dontwarn java.lang.invoke.*

-keep class io.reactivex.schedulers.Schedulers {
    public static <methods>;
}
-keep class io.reactivex.schedulers.ImmediateScheduler {
    public <methods>;
}
-keep class io.reactivex.schedulers.TestScheduler {
    public <methods>;
}
-keep class io.reactivex.schedulers.Schedulers {
    public static ** test();
}
-keepclassmembers class io.reactivex.internal.util.unsafe.*ArrayQueue*Field* {
    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

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

我这还是不行,那可能是我这边的问题,我再找找看,

ccominghome avatar Mar 06 '20 06:03 ccominghome

用AS 3.6.0,而不是 3.6.1,如果 3.6.0 没问题的话,建议会退到 3.6.0,新版本肯定有各种问题

JessYanCoding avatar Mar 06 '20 06:03 JessYanCoding

用AS 3.6.0,而不是 3.6.1,如果 3.6.0 没问题的话,建议会退到 3.6.0,新版本肯定有各种问题

可以了,是3.6.0,刚没清缓存

ccominghome avatar Mar 06 '20 06:03 ccominghome

那就用 3.6.0 吧

JessYanCoding avatar Mar 06 '20 07:03 JessYanCoding

那就用 3.6.0 吧

👌

ccominghome avatar Mar 06 '20 07:03 ccominghome

同样的问题。 我的是这样的,我迁移到androidx之后才出现这个问题。 试着降低到as3.5.0,build tool3.5.0,都无效。 后来注释了baseactivity中的oncreateview方法后,解决了。 原因未知。

2e2ee95304418f96 avatar Mar 16 '20 12:03 2e2ee95304418f96

3.6.2 同样遇到

lowly360 avatar Apr 03 '20 07:04 lowly360

为什么我用最新的没有这个问题

codesdt avatar Apr 17 '20 05:04 codesdt

迁移到androidx ,AS升级到3.6时出现同样的问题,崩溃的地方是BaseActivity中这行代码。 View view = convertAutoView(name, context, attrs); 项目中没有依赖autoLayout就会有这个问题,将这行代码注释就可以了,或者引入autoLayout的依赖。

qinghua0706 avatar Apr 20 '20 04:04 qinghua0706

  • Android Studio 3.6.2
  • gradle tools: 3.6.3
  • gradle : 6.1.1
  • 错误截图错误的截图
  • 如果不依赖autolayout,不混淆的时候不会有问题,混淆的时候有问题
  • 总之,问题出现在convertAutoView(name, context, attrs)这个方法中
  • 调试的时候DEPENDENCY_AUTO_LAYOUT这个值为false,并不会执行下面的语句,所以没有找到具体的bug
  • 目前可以在Base里边使用try{}catch(){}来解决这个问题 目前的解决方案截图

lzjtugjc avatar Apr 21 '20 08:04 lzjtugjc

那就用 3.6.0 吧 将这个项目中demo的build gradle tools 版本改为3.6.2,gradle:6.1.1,注释autolayout依赖,开启混淆,即可复现这个问题

lzjtugjc avatar Apr 21 '20 09:04 lzjtugjc

遇到同样的问题,as3.6.1 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

加入了autolayout依赖解决了问题

LnLooFa avatar May 01 '20 07:05 LnLooFa

遇到同样的问题,as3.6.1 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

加入了autolayout依赖解决了问题

完美解决问题

yigepang avatar May 29 '20 08:05 yigepang

遇到同样的问题,as3.6.1 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 加入了autolayout依赖解决了问题

完美解决问题

遇到同样的问题,as3.6.1 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

加入了autolayout依赖解决了问题

必须赞一个,我也是这样解决的,但真的一头雾水,为啥啊

gh1225987336 avatar Jun 28 '20 08:06 gh1225987336

遇到了同样的问题, 混淆时发现R8报了一个警告:

AGPBI: {"kind":"warning","text":"The method `android.view.View com.jess.arms.utils.ThirdViewUtil.convertAutoView(java.lang.String, android.content.Context, android.util.AttributeSet)` does not type check and will be assumed to be unreachable.","sources":[{}],"tool":"R8"}

翻译下该警告就是 该方法将不进行类型检查, 且被认为是不可达的.

convertAutoView方法中使用了autolayout中的类, 但是autolayout 的依赖方式为compileOnly

解决办法: 加入autolayout依赖, 或将arms模块中该依赖方式改为apiimplementation

aboutZZ avatar Jul 25 '20 10:07 aboutZZ

遇到了 onCreateView返回null问题解决 override fun onCreateView(name: String, context: Context, attrs: AttributeSet): View? { return null//super.onCreateView(name, context, attrs) }

932707629 avatar Aug 01 '20 11:08 932707629

应该把鸿神库完整在项目库中去掉 因为真的会影响启动

ruanbaojun1105 avatar Sep 23 '20 03:09 ruanbaojun1105

没有 不是这个问题

bj大侠 [email protected] 于2020年9月23日周三 上午11:46写道:

应该把鸿神库完整在项目库中去掉 因为真的会影响启动

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JessYanCoding/MVPArms/issues/358#issuecomment-697116816, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADANXCRT62V26JRXFGFYHSTSHFVQRANCNFSM4LCMNGQQ .

codesdt avatar Sep 30 '20 00:09 codesdt

这几天发版我又遇到了,时常偶现(可能是未发版时一直debug调试), 这次发版引入了其他三方 编写了防混淆规则依旧如此.目前正在参照上文朋友方法 注释鸿神库或者重新引入

LGlxb avatar Oct 22 '20 05:10 LGlxb

这几天发版我又遇到了,时常偶现(可能是未发版时一直调试调试),这次发版约会了其他三方编写了防篡改规则依旧如此。目前正在参照上文朋友方法注释鸿沟神库 根据测试 发现若无Moudle级别引用鸿神AutoLayout Base基类则会出现onCreateView viewnull返回 需要重新引用库 View view = convertAutoView(name, context, attrs); 调试的时候DEPENDENCY_AUTO_LAYOUT这个值为false,并不会执行下面的语句,所以没有找到具体的bug 目前可以在Base里边使用try{}catch(){}来解决这个问题,或者重新在Moudle级引用AutoLayout

LGlxb avatar Oct 22 '20 05:10 LGlxb

这个跟gradle版本有关系,as应该没事的,更换gradle版本就可以了,目前发现gradle 6.1.1编译后convertAutoView代码出现跟编译之前不一致,会抛出空指针

suwangen avatar Nov 17 '20 05:11 suwangen