PictureSelector (UCropMultipleActivity)Missing required parameters, count cannot be less than 1

kuuvgm7e  于 4个月前  发布在  其他
关注(0)|答案(1)|浏览(104)

Current use version?

当前使用的版本是多少?

3.10.9

Will this problem occur in demo?

Demo能否复现这问题?

不能

Describe the problem or provide an error log?

描述问题或提供错误log?

firebase错误日志

Caused by java.lang.IllegalArgumentException
Missing required parameters, count cannot be less than 1
com.yalantis.ucrop.UCropMultipleActivity.initCropFragments (UCropMultipleActivity.java:111)
com.yalantis.ucrop.UCropMultipleActivity.onCreate (UCropMultipleActivity.java:97)
android.app.Activity.performCreate (Activity.java:7144)

com.android.internal.os.ZygoteInit.main (ZygoteInit.java:858)
brjng4g3

brjng4g31#

我也遇到了,自己测试没问题,线上用户发生了,暂时不知道为啥,我的使用比较简单,就是用于选取用户的头像。

java.lang.RuntimeException:Unable to start activity ComponentInfo{com.zookzone.chat/com.yalantis.ucrop.UCropMultipleActivity}: java.lang.IllegalArgumentException: Missing required parameters, count cannot be less than 1
2
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
3
......
4
Caused by:
5
java.lang.IllegalArgumentException:Missing required parameters, count cannot be less than 1
6
com.yalantis.ucrop.UCropMultipleActivity.initCropFragments(UCropMultipleActivity.java:111)
7
com.yalantis.ucrop.UCropMultipleActivity.onCreate(UCropMultipleActivity.java:97)
8
android.app.Activity.performCreate(Activity.java:7009)
9
android.app.Activity.performCreate(Activity.java:7000)
10
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
11
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
12
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
13
android.app.ActivityThread.-wrap11(Unknown Source:0)
14
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
15
android.os.Handler.dispatchMessage(Handler.java:106)
16
android.os.Looper.loop(Looper.java:164)
17
android.app.ActivityThread.main(ActivityThread.java:6494)
18
java.lang.reflect.Method.invoke(Native Method)
19
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
20
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

`class ImageCropEngine : CropFileEngine {

override fun onStartCrop(
    fragment: Fragment, srcUri: Uri, destinationUri: Uri, dataSource: java.util.ArrayList<String>?, requestCode: Int
) {
    val options = Options()
    options.withAspectRatio(1.toFloat(), 1.toFloat())

    val uCrop = UCrop.of(srcUri, destinationUri, dataSource)
    uCrop.withOptions(options)
    uCrop.setImageEngine(object : UCropImageEngine {
        override fun loadImage(context: Context, url: String, imageView: ImageView) {
            if (!ActivityCompatHelper.assertValidRequest(context)) {
                return
            }
            val target = ImageRequest.Builder(context).data(url).target(imageView).build()
            context.imageLoader.enqueue(target)
        }

        override fun loadImage(
            context: Context, url: Uri, maxWidth: Int, maxHeight: Int, call: OnCallbackListener<Bitmap>
        ) {
            val loader = ImageLoader(context)
            val request = ImageRequest.Builder(context).data(url).target(onSuccess = { result: Drawable ->
                val bitmap = result.toBitmap()
                call.onCall(bitmap)
            }, onError = { _: Drawable? ->
                call.onCall(null)
            }).build()

            loader.enqueue(request)
        }
    })
    uCrop.start(fragment.requireActivity(), fragment, requestCode)
}

}
`

相关问题