问题描述

昨天有个朋友跟我反馈使用Imagepicker 这个插件在安装设备上 从相册选择图片的时候会闪退,让我帮忙看看

问题分析

连接AS,看了一下闪退日志如下:

2019-07-30 09:20:14.486 31449-31449/com.myapp.app.test E/AndroidRuntime: FATAL EXCEPTION: main Process: com.myapp.app.test, PID: 31449 java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/graphics/drawable/DrawableWrapper; at android.support.v7.widget.DrawableUtils.canSafelyMutateDrawable(DrawableUtils.java:147) at android.support.v7.widget.AppCompatDrawableManager.tintDrawable(AppCompatDrawableManager.java:257) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:207) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:192) at android.support.v7.widget.ToolbarWidgetWrapper.(ToolbarWidgetWrapper.java:184) at android.support.v7.widget.ToolbarWidgetWrapper.(ToolbarWidgetWrapper.java:91) at android.support.v7.widget.Toolbar.getWrapper(Toolbar.java:1780) at android.support.v7.widget.ActionBarOverlayLayout.getDecorToolbar(ActionBarOverlayLayout.java:538) at android.support.v7.widget.ActionBarOverlayLayout.pullChildren(ActionBarOverlayLayout.java:530) at android.support.v7.widget.ActionBarOverlayLayout.setWindowCallback(ActionBarOverlayLayout.java:606) at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:399) at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:312) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:277) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at com.synconset.MultiImageChooserActivity.onCreate(MultiImageChooserActivity.java:130) at android.app.Activity.performCreate(Activity.java:7327) at android.app.Activity.performCreate(Activity.java:7318) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3093) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3256) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1947) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7037) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)

根据错误反馈应该是android support V4和V7 的依赖包冲突导致的。

解决办法:

1、升级到V4或V7到最新版本
不过这个方法不一定有效

2、安装插件(推荐)[cordova-android-support-gradle-release] (https://www.npmjs.com/package/cordova-android-support-gradle-release)