getting error Don't forget to set CaptureStrategy
Miteshmakwana73 opened this issue · comments
Miteshmakwana73 commented
Getting this error if i set .capture(true)
Matisse.from(this@AddPostActivity)
.choose(MimeType.ofImage())
.showSingleMediaType(true)
.theme(R.style.Matisse_Dracula)
.capture(true)
.countable(true)
.maxSelectable(5)
.originalEnable(false)
.thumbnailScale(0.85f)
.imageEngine(GlideEngine())
.showPreview(false) // Default is `true`
.forResult(IMAGE_PICK_REQUEST_CODE)
FATAL EXCEPTION: main
Process: com.doseofsociety, PID: 15896
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.doseofsociety/com.zhihu.matisse.ui.MatisseActivity}: java.lang.RuntimeException: Don't forget to set CaptureStrategy.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3455)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3598)
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:2164)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:7582)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
Caused by: java.lang.RuntimeException: Don't forget to set CaptureStrategy.
at com.zhihu.matisse.ui.MatisseActivity.onCreate(MatisseActivity.java:116)
at android.app.Activity.performCreate(Activity.java:7822)
at android.app.Activity.performCreate(Activity.java:7811)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1328)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3430)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3598)
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:2164)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:241)
at android.app.ActivityThread.main(ActivityThread.java:7582)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
also added this in manifiest
</application>
<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>
<queries>
<intent>
<action android:name="android.media.action.VIDEO_CAPTURE" />
</intent>
</queries>
Miteshmakwana73 commented
added this line
.captureStrategy(new CaptureStrategy(true, BuildConfig.APPLICATION_ID))
also add file provider in manifest file