美文网首页Flutter开发圈
Flutter Android 运行 multi_image_p

Flutter Android 运行 multi_image_p

作者: 遥远不是北_ | 来源:发表于2019-12-06 15:49 被阅读0次

    multi_image_picker: ^4.5.2

    1. minSdkVersion的问题
    修改 ./android/app/build.gradle
    
    找到 defaultConfig {
    
    minSdkVersion 16 改为19
    
    }
    

    2.点击选择图片按钮后闪退

    W/art     ( 3413): Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
    I/art     ( 3413): Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
    I/art     ( 3413): Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$OnUnhandledKeyEventListenerWrapper>
    V/PhoneWindow( 3413): DecorView setVisiblity: visibility = 4 ,Parent =null, this =com.android.internal.policy.impl.PhoneWindow$DecorView{26dffa99 I.E..... R.....ID 0,0-0,0}
    D/ViewRootImpl( 3413): hardware acceleration is enabled, this = ViewRoot{114bd0ca com.deer.hotuserapp/com.sangcomz.fishbun.ui.album.AlbumActivity,ident = 1}
    V/PhoneWindow( 3413): DecorView setVisiblity: visibility = 0 ,Parent =ViewRoot{114bd0ca com.deer.hotuserapp/com.sangcomz.fishbun.ui.album.AlbumActivity,ident = 1}, this =com.android.internal.policy.impl.PhoneWindow$DecorView{26dffa99 V.E..... R.....ID 0,0-0,0}
    D/ActivityThread( 3413): hoder:android.app.IActivityManager$ContentProviderHolder@3d21a23b,provider,holder.Provider:android.content.ContentProviderProxy@3b623d58
    D/OpenGLRenderer( 3413): CanvasContext() 0x7f9287a300 initialize 0x7f9e641a10
    D/Surface ( 3413): Surface::connect(this=0x7f9e641a00,api=1)
    D/mali_winsys( 3413): new_window_surface returns 0x3000
    D/Surface ( 3413): Surface::allocateBuffers(this=0x7f9e641a00)
    E/RecyclerView( 3413): No adapter attached; skipping layout
    D/OpenGLRenderer( 3413): [TaskMgr] Running thread hwuiTask1 (3495)
    V/InputMethodManager( 3413): onWindowFocus: androidx.recyclerview.widget.RecyclerView{1587bc09 VFED.... .F....ID 0,112-720,1244 #7f080082 app:id/recycler_album_list} softInputMode=272 first=true flags=#81810100
    V/InputMethodManager( 3413): START INPUT: androidx.recyclerview.widget.RecyclerView{1587bc09 VFED.... .F....ID 0,112-720,1244 #7f080082 app:id/recycler_album_list} ic=null tba=android.view.inputmethod.EditorInfo@26bb902b controlFlags=#105
    I/art     ( 3413): Rejecting re-init on previously-failed class java.lang.Class<com.bumptech.glide.util.CachedHashCodeArrayMap>
    I/art     ( 3413): Rejecting re-init on previously-failed class java.lang.Class<com.bumptech.glide.util.CachedHashCodeArrayMap>
    I/art     ( 3413): Rejecting re-init on previously-failed class java.lang.Class<com.bumptech.glide.util.CachedHashCodeArrayMap>
    I/art     ( 3413): Rejecting re-init on previously-failed class java.lang.Class<com.bumptech.glide.load.resource.gif.GifDrawable>
    I/art     ( 3413): Rejecting re-init on previously-failed class java.lang.Class<com.bumptech.glide.load.resource.gif.GifDrawable>
    I/art     ( 3413): Rejecting re-init on previously-failed class java.lang.Class<com.bumptech.glide.util.CachedHashCodeArrayMap>
    I/art     ( 3413): Rejecting re-init on previously-failed class java.lang.Class<com.bumptech.glide.util.CachedHashCodeArrayMap>
    D/AndroidRuntime( 3413): Shutting down VM
    E/AndroidRuntime( 3413): FATAL EXCEPTION: main
    E/AndroidRuntime( 3413): Process: com.deer.hotuserapp, PID: 3413
    E/AndroidRuntime( 3413): java.lang.NoClassDefFoundError: com.bumptech.glide.util.CachedHashCodeArrayMap
    E/AndroidRuntime( 3413):    at com.bumptech.glide.load.Options.<init>(Options.java:14)
    E/AndroidRuntime( 3413):    at com.bumptech.glide.request.BaseRequestOptions.<init>(BaseRequestOptions.java:94)
    E/AndroidRuntime( 3413):    at com.bumptech.glide.request.RequestOptions.<init>(RequestOptions.java:26)
    E/AndroidRuntime( 3413):    at com.sangcomz.fishbun.adapter.image.impl.GlideAdapter.loadImage(GlideAdapter.java:17)
    E/AndroidRuntime( 3413):    at com.sangcomz.fishbun.adapter.view.AlbumListAdapter.onBindViewHolder(AlbumListAdapter.java:56)
    E/AndroidRuntime( 3413):    at com.sangcomz.fishbun.adapter.view.AlbumListAdapter.onBindViewHolder(AlbumListAdapter.java:25)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6781)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6823)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5752)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6019)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.GridLayoutManager.layoutChunk(GridLayoutManager.java:557)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.GridLayoutManager.onLayoutChildren(GridLayoutManager.java:171)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3641)
    E/AndroidRuntime( 3413):    at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4194)
    E/AndroidRuntime( 3413):    at android.view.View.layout(View.java:16024)
    E/AndroidRuntime( 3413):    at android.view.ViewGroup.layout(ViewGroup.java:5203)
    E/AndroidRuntime( 3413):    at com.google.android.material.appbar.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:142)
    E/AndroidRuntime( 3413):    at com.google.android.material.appbar.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:41)
    E/AndroidRuntime( 3413):    at com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1556)
    E/AndroidRuntime( 3413):    at androidx.coordinatorlayout.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:888)
    E/AndroidRuntime( 3413):    at android.view.View.layout(View.java:16024)
    E/AndroidRuntime( 3413):    at android.view.ViewGroup.layout(ViewGroup.java:5203)
    E/AndroidRuntime( 3413):    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639)
    E/AndroidRuntime( 3413):    at android.widget.FrameLayout.onLayout(FrameLayout.java:574)
    E/AndroidRuntime( 3413):    at android.view.View.layout(View.java:16024)
    E/AndroidRuntime( 3413):    at android.view.ViewGroup.layout(ViewGroup.java:5203)
    E/AndroidRuntime( 3413):    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959)
    E/AndroidRuntime( 3413):    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813)
    E/AndroidRuntime( 3413):    at android.widget.LinearLayout.onLayout(LinearLayout.java:1722)
    E/AndroidRuntime( 3413):    at android.view.View.layout(View.java:16024)
    E/AndroidRuntime( 3413):    at android.view.ViewGroup.layout(ViewGroup.java:5203)
    E/AndroidRuntime( 3413):    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639)
    E/AndroidRuntime( 3413):    at android.widget.FrameLayout.onLayout(FrameLayout.java:574)
    E/AndroidRuntime( 3413):    at android.view.View.layout(View.java:16024)
    E/AndroidRuntime( 3413):    at android.view.ViewGroup.layout(ViewGroup.java:5203)
    E/AndroidRuntime( 3413):    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959)
    E/AndroidRuntime( 3413):    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813)
    E/AndroidRuntime( 3413):    at android.widget.LinearLayout.onLayout(LinearLayout.java:1722)
    E/AndroidRuntime( 3413):    at android.view.View.layout(View.java:16024)
    E/AndroidRuntime( 3413):    at android.view.ViewGroup.layout(ViewGroup.java:5203)
    E/AndroidRuntime( 3413):    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639)
    E/AndroidRuntime( 3413):    at android.widget.FrameLayout.onLayout(FrameLayout.java:574)
    E/AndroidRuntime( 3413):    at android.view.View.layout(View.java:16024)
    E/AndroidRuntime( 3413):    at android.view.ViewGroup.layout(ViewGroup.java:5203)
    E/AndroidRuntime( 3413):    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2524)
    E/AndroidRuntime( 3413):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2214)
    E/AndroidRuntime( 3413):    
    I/Process ( 3413): Sending signal. PID: 3413 SIG: 9
    

    修改 ./android/gradle.properties 增加如下两行


    image.png
    android.enableJetifier=true
    android.useAndroidX=true
    
    android.useAndroidX=true 表示当前项目启用 AndroidX
    android.enableJetifier=true 表示将依赖包也迁移到AndroidX 。如果取值为 false ,表示不迁移依赖包到AndroidX,但在使用依赖包中的内容时可能会出现问题,当然了,如果你的项目中没有使用任何三方依赖,那么,此项可以设置为 false
    

    相关文章

      网友评论

        本文标题:Flutter Android 运行 multi_image_p

        本文链接:https://www.haomeiwen.com/subject/jkdegctx.html