Giter VIP home page Giter VIP logo

Comments (14)

leavesCZY avatar leavesCZY commented on September 13, 2024

你使用的 compose 版本是多少呢

from matisse.

yzc90912 avatar yzc90912 commented on September 13, 2024

2024.03.00 和demo版本一致

from matisse.

leavesCZY avatar leavesCZY commented on September 13, 2024

你需要看下 compose.foundation 的具体版本,bom 本身是没法强制指定项目最终打包时的版本的。有可能你实际依赖的是高版本的 compose.foundation,类似于这个问题:#17

from matisse.

yzc90912 avatar yzc90912 commented on September 13, 2024

1.6.4

from matisse.

leavesCZY avatar leavesCZY commented on September 13, 2024

=_=

from matisse.

weiquanbin avatar weiquanbin commented on September 13, 2024

可否添加一个先配置项,用来关闭预览功能

from matisse.

leavesCZY avatar leavesCZY commented on September 13, 2024

@weiquanbin 你是指左下角的预览按钮,还是点击图片后进行预览的功能呢?还是说全部?我不太理解为什么你会有这种需求

from matisse.

weiquanbin avatar weiquanbin commented on September 13, 2024

@leavesCZY 现在预览会报错啊,不是不能打包时制定foundation的版本么,你让用户可以暂时把这个功能去掉,就不会有这问题了,而且有的项目需求,是没有要到预览的,可以关掉的选项,也算一种丰富。我试过把预览文本变成空字符,但显然点击区域不止是文本,依然会跳预览界面,从而报错

from matisse.

leavesCZY avatar leavesCZY commented on September 13, 2024

@weiquanbin 这种只能掩盖问题而不能解决问题。如果预览报错,我觉得你应该做的是给出引用的 Matisse 版本,compose 版本以及复现出该问题的步骤方法,再不济你也可以运行下 Matisse,看下和你项目是有哪些差异导致报错的

from matisse.

weiquanbin avatar weiquanbin commented on September 13, 2024

@leavesCZY 问题完全是跟楼主一样的,引入最新的2.0.0,bom 2024.04.00,点击图片预览即crash,java.lang.NoSuchMethodError: No static method HorizontalPager-xYaah8o。
至于问题的解决,因为目的的不同,对于我来说,关闭预览功能就是解决了问题,其实我自己可以拉代码改了就好。只是因为你说了打包版本无法控制,我提了对于我来说有用的相关的意见。
大大可以无视哈

from matisse.

leavesCZY avatar leavesCZY commented on September 13, 2024

@weiquanbin 我上面可能描述得不够清楚,你打开看下上面 issues 17 的链接应该就能明白了。因为不同 compose 版本的 HorizontalPager 可能 API 各不相同,导致和 Matisse 内部出现了不兼容的情况。issues 17 就是由于开发者引用了高版本且处于 beta 阶段的 HorizontalPager 导致了 crash。如果方便的话,我是更希望你能确定下你的项目是否就是由于这种原因导致的,这种情况就是你自己可以控制的了。如果是单纯由于 Matisse 导致的那我也能修复下 bug 解决你的问题。而你上面说的提供关闭预览功能的配置项,抱歉,在我这个角度下是不太合理的,如果是 Matisse 有问题的话我还是想尽量解决问题哈,也欢迎你 fork 源代码随意进行定制哈

from matisse.

weiquanbin avatar weiquanbin commented on September 13, 2024

@leavesCZY Build version: 1.0
Current date: 2024-04-12 11:31:38
Device: Xiaomi M2102K1AC
OS version: Android 13 (SDK 33)

Stack trace:
java.lang.NoSuchMethodError: No static method HorizontalPager-xYaah8o(Landroidx/compose/foundation/pager/PagerState;Landroidx/compose/ui/Modifier;Landroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/foundation/pager/PageSize;IFLandroidx/compose/ui/Alignment$Vertical;Landroidx/compose/foundation/gestures/snapping/SnapFlingBehavior;ZZLkotlin/jvm/functions/Function1;Landroidx/compose/ui/input/nestedscroll/NestedScrollConnection;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;III)V in class Landroidx/compose/foundation/pager/PagerKt; or its super classes (declaration of 'androidx.compose.foundation.pager.PagerKt' appears in /data/data/com.xjprhinox.plantphoto/code_cache/.overlay/base.apk/classes.dex)
at github.leavesczy.matisse.internal.ui.MatissePreviewPageKt$MatissePreviewPage$3$1.invoke(MatissePreviewPage.kt:106)
at github.leavesczy.matisse.internal.ui.MatissePreviewPageKt$MatissePreviewPage$3$1.invoke(MatissePreviewPage.kt:100)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:118)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1$bodyContentPlaceables$1.invoke(Scaffold.kt:303)
at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1$bodyContentPlaceables$1.invoke(Scaffold.kt:285)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:995)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$subcompose$3$1$1.invoke(SubcomposeLayout.kt:478)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:109)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:95)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3403)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3336)
at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:736)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:1096)
at androidx.compose.runtime.ComposerImpl$CompositionContextImpl.composeInitial$runtime_release(Composer.kt:3703)
at androidx.compose.runtime.CompositionImpl.composeInitial(Composition.kt:644)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:630)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcomposeInto(SubcomposeLayout.kt:501)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:473)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:464)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState.subcompose(SubcomposeLayout.kt:448)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$Scope.subcompose(SubcomposeLayout.kt:873)
at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1.invoke-0kLqBqw(Scaffold.kt:285)
at androidx.compose.material3.ScaffoldKt$ScaffoldLayoutWithMeasureFix$1$1.invoke(Scaffold.kt:179)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:710)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:254)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:253)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2303)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:500)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:256)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1619)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:38)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:622)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:598)
at androidx.compose.foundation.layout.BoxMeasurePolicy.measure-3p2s80s(Box.kt:122)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126)
at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:131)
at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:131)
at androidx.compose.foundation.layout.FillNode.measure-3p2s80s(Size.kt:699)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:131)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:254)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:253)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2303)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:500)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:256)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1619)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:38)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:622)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:598)
at androidx.compose.animation.AnimatedEnterExitMeasurePolicy.measure-3p2s80s(AnimatedVisibility.kt:852)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126)
at androidx.compose.animation.EnterExitTransitionModifierNode.measure-3p2s80s(EnterExitTransition.kt:1156)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:131)
at androidx.compose.ui.graphics.SimpleGraphicsLayerModifier.measure-3p2s80s(GraphicsLayerModifier.kt:646)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:131)
at androidx.compose.animation.AnimatedVisibilityKt$AnimatedVisibilityImpl$1$1.invoke-3p2s80s(AnimatedVisibility.kt:746)
at androidx.compose.animation.AnimatedVisibilityKt$AnimatedVisibilityImpl$1$1.invoke(AnimatedVisibility.kt:745)
at androidx.compose.ui.layout.LayoutModifierImpl.measure-3p2s80s(LayoutModifier.kt:294)
at androidx.compose.ui.node.LayoutModifierNodeCoordinator.measure-BRTryo0(LayoutModifierNodeCoordinator.kt:131)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:254)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:253)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2303)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:500)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:256)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1619)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:38)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:622)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:598)
at androidx.compose.ui.layout.RootMeasurePolicy.measure-3p2s80s(RootMeasurePolicy.kt:48)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:126)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:254)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$performMeasureBlock$1.invoke(LayoutNodeLayoutDelegate.kt:253)
at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:2303)
at androidx.compose.runtime.snapshots.SnapshotStateObserver$ObservedScopeMap.observe(SnapshotStateObserver.kt:500)
at androidx.compose.runtime.snapshots.SnapshotStateObserver.observeReads(SnapshotStateObserver.kt:256)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeReads$ui_release(OwnerSnapshotObserver.kt:133)
at androidx.compose.ui.node.OwnerSnapshotObserver.observeMeasureSnapshotReads$ui_release(OwnerSnapshotObserver.kt:113)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:1619)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate.access$performMeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:38)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:622)
at androidx.compose.ui.node.LayoutNode.remeasure-_Sx5XlM$ui_release(LayoutNode.kt:1150)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.doRemeasure-sdFAvZA(MeasureAndLayoutDelegate.kt:358)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.remeasureOnly(MeasureAndLayoutDelegate.kt:572)
at androidx.compose.ui.node.MeasureAndLayoutDelegate.measureOnly(MeasureAndLayoutDelegate.kt:411)
at androidx.compose.ui.platform.AndroidComposeView.onMeasure(AndroidComposeView.android.kt:1173)
at android.view.View.measure(View.java:26555)
at androidx.compose.ui.platform.AbstractComposeView.internalOnMeasure$ui_release(ComposeView.android.kt:302)
at androidx.compose.ui.platform.AbstractComposeView.onMeasure(ComposeView.android.kt:289)
at android.view.View.measure(View.java:26555)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7021)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145)
at android.view.View.measure(View.java:26555)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7021)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:26555)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7021)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:26555)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7021)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:26555)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7021)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:835)
at android.view.View.measure(View.java:26555)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:4113)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2818)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3092)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2530)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9401)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1451)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1459)
at android.view.Choreographer.doCallbacks(Choreographer.java:1089)
at android.view.Choreographer.doFrame(Choreographer.java:1003)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1431)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8261)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)

User actions:
2024-04-12 11:31:09: MainActivity created
2024-04-12 11:31:09: MainActivity resumed
2024-04-12 11:31:20: MainActivity paused
2024-04-12 11:31:20: MatisseActivity created
2024-04-12 11:31:20: MatisseActivity resumed
错误日志在这里,问题就是出在HorizontalPager,所以我第一时间就认同了你的说法,是compose版本导致的,但我有疑问的在于大大你的源码compose平台2024.03.00的版本也不低啊,哪怕我回退到了跟你代码一样的版本,依然会crash,这就让我挺费解的,按理来讲这跟版本就没什么关系了吧,还是说你那边特别制定了低版本的foundcation?

那如果真是这样的话,就又引发了别的问题了,如果我就是想使用特定版本的compse,但又与大大你的不兼容,这个问题是不是就无法解决了呢

from matisse.

leavesCZY avatar leavesCZY commented on September 13, 2024

@weiquanbin 我复现出你这个问题了。我的复现方式是:2024.03.00 版本的 compose-bom 对应的 compose.foundation 版本是 1.6.2,如果再主动依赖下 "androidx.compose.foundation:foundation:1.7.0-alpha06" 的话,此时 Matisse 就会出现你的这个问题了

Matisse 内部的 compose-bom 只能约束其内部引用的 compose 版本。有可能你的项目使用到了其它 compose 库,而这个库引用的是高版本的 compose.foundation,最终你打包进 apk 里的就是这个高版本,从而连锁导致出现 crash 的问题

你查看 compose.foundation 版本不能只看显式声明的版本,主要看 external libraries 才行

你需要确认下你的项目是不是就是由于以上原因导致的。如果是的话,那只能是你那边根据实际情况看如何避免引用高版本 compose 了,毕竟那些还处于 alpha 阶段,本身就是不太稳定的。而 Matisse 和目前最新的 release 版本都是兼容的

from matisse.

leavesCZY avatar leavesCZY commented on September 13, 2024

@weiquanbin 如果不是这个原因导致的话,欢迎继续反馈哈

from matisse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.