drjacky / imagepicker Goto Github PK
View Code? Open in Web Editor NEW📸Image Picker for Android, Pick images from Gallery or Capture a new image with Camera🖼
Home Page: https://github.com/Drjacky/ImagePicker
License: Apache License 2.0
📸Image Picker for Android, Pick images from Gallery or Capture a new image with Camera🖼
Home Page: https://github.com/Drjacky/ImagePicker
License: Apache License 2.0
for the new version 2.1.17
Android version:10
Getting this while building the app (android version Lollipop)
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find :unspecified:.
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.1
> Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.1
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
error msg _> More than one file was found with OS independent path 'META-INF/imagepicker_release.kotlin_module'
Hi
what I am trying to do is in same page got 3 different images to capture,in latest version I am unable to pass request code in
ImagePicker.Companion.with(this)
.crop()
.cropOval()
.maxResultSize(512, 512, true)
.createIntentFromDialog((Function1) (new Function1() {
public Object invoke(Object var1) {
this.invoke((Intent) var1);
return Unit.INSTANCE;
}
public final void invoke(@NotNull Intent it) {
Intrinsics.checkNotNullParameter(it, "it");
launcher.launch(it);
}
}));
I want to pass custom request code as show in your git document and on launcher I can capture as per request code shown below
ActivityResultLauncher<Intent> launcher =
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), (ActivityResult result) -> {
if (result.getResultCode() == RESULT_OK) {
//here I want to check request code so that I can use my logic
} else if (result.getResultCode() == ImagePicker.RESULT_ERROR) {
// Use ImagePicker.Companion.getError(result.getData()) to show an error
}
});
Code Usage
ImagePicker.Companion.with(this)
.compress(1024)
.maxResultSize(1080, 1080)
.start(PROFILE_IMAGE_REQ_CODE);
implementation 'com.github.Drjacky:ImagePicker:1.7.10'
implementation 'com.github.florent37:inline-activity-result-kotlin:1.0.4'
Build Error
error: cannot access Function2
.start(PROFILE_IMAGE_REQ_CODE);//PROFILE_IMAGE_REQ_CODE
^
class file for kotlin.jvm.functions.Function2 not found
Describe the bug
When I run app, this error found on log and stopped running further.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.7.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:2.1.13
To Reproduce
Expected behavior
Run with no issues.
Screenshots
Used in MainActivity on onCreate method.
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ImagePicker.with(MainActivity.this)
.createIntent();
}
});
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context
This is my build.gradle App
plugins {
id 'com.android.application'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.example"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'com.airbnb.android:lottie:4.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.github.Drjacky:ImagePicker:2.1.13'
}
This is my build.gradle Project
buildscript {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.1"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Describe the bug
Call createIntentFromDialog option , Camera and gallery option displayed. where Y of gallery text shows cropped from bottom.
Expected behavior
Both Camera and Gallery text should be clear visible without cropped text
Screenshots
If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Is your feature request related to a problem? Please describe.
I don't want to keep the selected image in the storage, only cropped one. And now, my only option is to manually delete it.
Describe the solution you'd like
Builder option, something like .saveOnlyCroppedImg()
.
Describe alternatives you've considered
Return both image URIs for the activity result.
Additional context
I think it definitely belongs here, because this library stores both images and appends suffixes to them by default. And it would be nice to have the ability to customize this behavior. 🙂
Getting a 'Not found' gradle error for ucrop on a kotlin project. Tried manually adding that to the gradle as well.
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.github.yalantis:ucrop:2.2.7.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
Required by:
project :app
> Could not find com.github.yalantis:ucrop:2.2.7.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.7/ucrop-2.2.7.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:2.1.15
Hi,
When We click on the gallery icon in the dialog box it does not open the gallery app. But open the document file to choose image.
I'm using this code
ImagePicker.with(this) .galleryOnly() //User can only select image from Gallery .start() //Default Request Code is ImagePicker.REQUEST_CODE
It opens File / Document App not a Gallery App ?
I just tried as Readme notes
but createIntentFromDialog and createIntent not worked
and ImagePickerActivity not launched
I can't get version 1.8.4:
Execution failed for task ':androidApp:dataBindingMergeDependencyArtifactsDebug'.
> Could not resolve all files for configuration ':androidApp:debugCompileClasspath'.
> Could not find com.github.drjacky:ImagePicker:1.8.4.
Required by:
project :androidApp
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Hi, Is there an option to pick multiple images? Thanks.
Hello @Drjacky , I hope this message finds you well.
Remember this conversation? Does your lib manages to solve this restrictions/findings?
Regards.
Your lib is working fine on all of my emulator API 24 to 30 on dev flavor.
But in production (PlayStore, device API 29) I get a toast with "Storage permission is needed to take a picture. Please allow storage permission from Settings -> Permissions.".
Am I missing something obvious ?
I copy your sample/manifest permissions :/
thx
Version: 1.8.1
The library is really well written also the documentation. I need to upload both image and video so.
Please provide the support for the video uploading from both gallery and camera. Not the compressed one for now, but better if it is also included.
Thank you.
FAILURE: Build completed with 8 failures.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.github.yalantis:ucrop:2.2.6.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://repo.maven.apache.org/maven2/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
- https://jcenter.bintray.com/com/github/yalantis/ucrop/2.2.6/ucrop-2.2.6.pom
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.4
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 4s
20 actionable tasks: 19 executed, 1 up-to-date
when I start to build then it shows building fail and error .
please refer to this image.
Hi there
I wanted to point out that the requestLegacyExternaStorage flag in the Manifest will be ignored when targhetting Android 11.
https://developer.android.com/about/versions/11/privacy/storage
Apps that run on Android 11 but target Android 10 (API level 29) can still request the requestLegacyExternalStorage attribute. >This flag allows apps to temporarily opt out of the changes associated with scoped storage, such as granting access to different >directories and different types of media files. After you update your app to target Android 11, the system ignores the >requestLegacyExternalStorage flag.
I need help regarding how to call intent with request code & get result from different request code
I have added the required repositories and dependency but still not working
App crashes without any error when selecting image from gallery.
After allowing storage permission , app crashes and in logs it comes access permission issue, though i already allowed permission.
it should redirect to settings to manage storage permission as per solutions suggested in developer.com and on stack overflow.
Please let me know how this can be fixed , if anything has to be added in manifest of anything
Is your feature request related to a problem? Please describe.
Currently you cannot define output format and the origin format is used. If you pick a jpg file and crop it you have to convert to webp on your own
Describe the solution you'd like
On the library level it would be easy to convert e.g.
FileOutputStream out = new FileOutputStream(path);
bitmap.compress(Bitmap.CompressFormat.WEBP, 100, out);
out.close();
When selecting transparent image/logo display black background in ImageView
Hello,
I am using your library in a production application and have received some bug reports in my crashalytics dashboard.
It seems to affect certain devices running Android 10. I have tested locally with emulators and devices running Android 10 but could not reproduce the issue.
Firebase logs
Caused by android.graphics.ImageDecoder$DecodeException: Input was incomplete.
at android.graphics.ImageDecoder.onPartialImage(ImageDecoder.java:1967)
at android.graphics.ImageDecoder.nDecodeBitmap(ImageDecoder.java)
at android.graphics.ImageDecoder.decodeBitmapInternal(ImageDecoder.java:1697)
at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1854)
at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1945)
at com.github.drjacky.imagepicker.provider.CropProvider.getBitmap(CropProvider.kt:173)
at com.github.drjacky.imagepicker.provider.CropProvider.cropImage(CropProvider.kt:123)
at com.github.drjacky.imagepicker.provider.CropProvider.startIntent(CropProvider.kt:105)
at com.github.drjacky.imagepicker.ImagePickerActivity.setImage(ImagePickerActivity.kt:162)
at com.github.drjacky.imagepicker.provider.CameraProvider.handleResult(CameraProvider.kt:156)
at com.github.drjacky.imagepicker.ImagePickerActivity$cameraLauncher$1.onActivityResult(ImagePickerActivity.kt:54)
at com.github.drjacky.imagepicker.ImagePickerActivity$cameraLauncher$1.onActivityResult(ImagePickerActivity.kt:25)
at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:377)
at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:336)
at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:624)
at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:164)
at android.app.Activity.dispatchActivityResult(Activity.java:8292)
at android.app.ActivityThread.deliverResults(ActivityThread.java:5223)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5271)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
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:2216)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7948)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
and
Caused by android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'unimplemented'Input contained an error.
at android.graphics.ImageDecoder.nCreate(ImageDecoder.java)
at android.graphics.ImageDecoder.createFromAssetFileDescriptor(ImageDecoder.java:351)
at android.graphics.ImageDecoder.access$400(ImageDecoder.java:173)
at android.graphics.ImageDecoder$ContentResolverSource.createImageDecoder(ImageDecoder.java:289)
at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1847)
at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1945)
at com.github.drjacky.imagepicker.provider.CropProvider.getBitmap(CropProvider.kt:173)
at com.github.drjacky.imagepicker.provider.CropProvider.cropImage(CropProvider.kt:123)
at com.github.drjacky.imagepicker.provider.CropProvider.startIntent(CropProvider.kt:105)
at com.github.drjacky.imagepicker.ImagePickerActivity.setImage(ImagePickerActivity.kt:162)
at com.github.drjacky.imagepicker.provider.CameraProvider.handleResult(CameraProvider.kt:156)
at com.github.drjacky.imagepicker.ImagePickerActivity$cameraLauncher$1.onActivityResult(ImagePickerActivity.kt:54)
at com.github.drjacky.imagepicker.ImagePickerActivity$cameraLauncher$1.onActivityResult(ImagePickerActivity.kt:25)
at androidx.activity.result.ActivityResultRegistry$1.onStateChanged(ActivityResultRegistry.java:148)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:265)
at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:307)
at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:148)
at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134)
at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:68)
at androidx.lifecycle.ReportFragment$LifecycleCallbacks.onActivityPostStarted(ReportFragment.java:187)
at android.app.Activity.dispatchActivityPostStarted(Activity.java:1274)
at android.app.Activity.performStart(Activity.java:8026)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3677)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Smartphone (please complete the following information):
All the logs are from devices running Android 10. Affected models seems to include:
Code
Intent intent = ImagePicker.Companion.with(this)
.cameraOnly()
.crop()
.createIntent();
The problem seems to arise in the crop functionality before the activity result callback function is called.
The problems have originated in apps which used version 2.1.7 of the library. I upgraded the library to the latest version (2.1.12) but I am not sure this will fix the issues. Any help regarding the issue would be much appreciated.
Describe the bug
Canvas: trying to draw too large(256576512bytes) bitmap.
To Reproduce
Steps to reproduce the behavior:
Smartphone (please complete the following information):
Logcat stack trace
java.lang.RuntimeException: Canvas: trying to draw too large(256576512bytes) bitmap.
at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:281)
at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:91)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:548)
at com.squareup.picasso.PicassoDrawable.draw(PicassoDrawable.java:109)
at android.widget.ImageView.onDraw(ImageView.java:1453)
at android.view.View.draw(View.java:23901)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.recyclerview.widget.RecyclerView.drawChild(RecyclerView.java:5030)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at androidx.recyclerview.widget.RecyclerView.draw(RecyclerView.java:4429)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at android.widget.ScrollView.draw(ScrollView.java:2876)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1277)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.fragment.app.FragmentContainerView.drawChild(FragmentContainerView.java:268)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.fragment.app.FragmentContainerView.dispatchDraw(FragmentContainerView.java:256)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at androidx.constraintlayout.widget.ConstraintLayout.dispatchDraw(ConstraintLayout.java:1975)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
2021-10-20 15:54:36.684 28776-28776/? E/AndroidRuntime: at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1277)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at androidx.drawerlayout.widget.DrawerLayout.drawChild(DrawerLayout.java:1478)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.updateDisplayListIfDirty(View.java:22762)
at android.view.View.draw(View.java:23631)
at android.view.ViewGroup.drawChild(ViewGroup.java:5336)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:5093)
at android.view.View.draw(View.java:23904)
at com.android.internal.policy.DecorView.draw(DecorView.java:1282)
at android.view.View.updateDisplayListIfDirty(View.java:22776)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:579)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:585)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:662)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4994)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4701)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3818)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2575)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9910)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1010)
at android.view.Choreographer.doCallbacks(Choreographer.java:809)
at android.view.Choreographer.doFrame(Choreographer.java:744)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:995)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8506)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Describe the bug
Failed to resolve: com.github.yalantis:ucrop:2.2.7
To Reproduce
Steps to reproduce the behavior:
maven { url "https://jitpack.io" }
under repositoriesimplementation 'com.github.Drjacky:ImagePicker:2.1.14'
under dependenciesExpected behavior
Should work just fine
Desktop (please complete the following information):
Hi! A lot of thanks for your job!
I used before https://github.com/Dhaval2404/ImagePicker , but Google send a letter "We've detected that your app contains the requestLegacyExternalStorage flag in the manifest file of 1 or more of your app bundles or APKs."
And I found your comments and your library, so...
My old code was:
private void avatarTouch() {
ImagePicker.Companion.with(this)
.crop(1f, 1f)
.compress(1024)
.maxResultSize(1080, 1080)
.start();
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
Uri uri = data.getData();
//File file = ImagePicker.Companion.getFile(data);
//String filePath = ImagePicker.Companion.getFilePath(data);
if (uri != null) {
Picasso.get().load(uri).into(viewManager.avatarImageView);
}
} else if (resultCode == ImagePicker.RESULT_ERROR) {
// Error
Map<String, String> map = new HashMap<>();
map.put("error", ImagePicker.Companion.getError(data));
FirebaseModel.shared().sendAnalytics(MyApplication.context, "image_picker_error", map);
Toast.makeText(MyApplication.context, ImagePicker.Companion.getError(data), Toast.LENGTH_LONG).show();
} else {
// Cancel
}
}
Could you please help me to change my code. I can't find an example on java how to use your library :(
Thanks!
Describe the bug
Hard to say because I did not see anything in logcat. App has target api 31 as well. Invocation is within jetpack compose. Please give me further instructions to assist
To Reproduce
Steps to reproduce the behaviour:
ImagePicker.with(context as Activity)
.maxResultSize(maxAvatarSize, maxAvatarSize)
.cropSquare()
.createIntentFromDialog { launcher.launch(it) }
Expected behavior
Image picker is opened
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
all of my phones
Thanks for your great library!
While trying to use it, I got an error:
Could not determine the dependencies of task ':app:compileGplayDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:gplayDebugCompileClasspath'.
> Could not find :unspecified:.
Required by:
project :app > com.github.Drjacky:ImagePicker:1.8.1
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
This was with: implementation 'com.github.Drjacky:ImagePicker:1.8.1'
Changing it to implementation 'com.github.drJacky:ImagePicker:1.8.1'
as found on https://jitpack.io/#drJacky/ImagePicker/1.8.1 worked.
Is your feature request related to a problem? Please describe.
When starting with cameraOnly()
I would like to be able to set ImagePicker to either A) only allow the front camera or B) start with the front camera and allow the user to switch to the rear camera.
Describe the solution you'd like
For either of the cases above, a config option similar to cameraOnly
like frontCameraOnly
or startFrontCamera
that either restricts user to front camera, or starts them off with it.
Describe alternatives you've considered
I tried overriding the provider methods in library, but haven't had much luck with it.
Additional context
Basically I'm using this library to capture or pick profile photos. Those are typically taken as selfies and not from the rear camera.
hi,
I try to allow access to both the camera and the gallery.
When I run the app it crashes
Would appreciate help.
i used with this code:
ImagePicker.Companion.with(this)
.crop()
.cropOval()
.maxResultSize(512, 512, true)
.createIntentFromDialog((Function1) (new Function1() {
public Object invoke(Object var1) {
this.invoke((Intent) var1);
return Unit.INSTANCE;
}
public final void invoke(@NotNull Intent it) {
Intrinsics.checkNotNullParameter(it, "it");
launcher.launch(it);
}
}));
when i used with this code- only gallery was open and camera crashes:
ImagePicker.Companion.with(HomePageActivity.this)
.crop()
//.cropOval()
//.compress(1024)
.maxResultSize(1080,1080)
.galleryMimeTypes(mimeTypes)
.start();
Java language
Thanks for this library. Have you any idea how to allow the returned Uri
as a persistable URI? I think it requires putting a flag in the startActivity Intent
but I see no way to add flags.
requireActivity().grantUriPermission(
requireActivity().packageName,
fileUri,
data.flags and
Intent.FLAG_GRANT_READ_URI_PERMISSION and
Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION
)
requireActivity().contentResolver.takePersistableUriPermission(
fileUri,
data.flags and
Intent.FLAG_GRANT_READ_URI_PERMISSION
)
Log:
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=530587092, result=-1, data=Intent { dat=file:///storage/emulated/0/DCIM/Camera/IMG_20210323_162851252.jpg (has extras) }} to activity {uk.co.imagitech.completetheorytestkit/uk.co.imagitech.learn2.passguarantee.PassGuaranteeClaimActivity}: java.lang.SecurityException: No persistable permission grants found for UID 10161 and Uri file:///storage/emulated/0/DCIM/Camera/IMG_20210323_162851252.jpg
at android.app.ActivityThread.deliverResults(ActivityThread.java:5015)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5056)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
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:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.SecurityException: No persistable permission grants found for UID 10161 and Uri file:///storage/emulated/0/DCIM/Camera/IMG_20210323_162851252.jpg
at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
at android.os.Parcel.createException(Parcel.java:2357)
at android.os.Parcel.readException(Parcel.java:2340)
at android.os.Parcel.readException(Parcel.java:2282)
at android.app.IUriGrantsManager$Stub$Proxy.takePersistableUriPermission(IUriGrantsManager.java:280)
at android.content.ContentResolver.takePersistableUriPermission(ContentResolver.java:2851)
at uk.co.imagitech.learn2.passguarantee.ui.PassGuaranteeClaimFragment$onActivityCreated$1$1.invoke(PassGuaranteeClaimFragment.kt:58)
at uk.co.imagitech.learn2.passguarantee.ui.PassGuaranteeClaimFragment$onActivityCreated$1$1.invoke(PassGuaranteeClaimFragment.kt:22)
at com.github.drjacky.imagepicker.ImagePicker$Builder$startActivity$1.invoke(ImagePicker.kt:359)
at com.github.drjacky.imagepicker.ImagePicker$Builder$startActivity$1.invoke(ImagePicker.kt:92)
at com.github.florent37.inlineactivityresult.kotlin.Kotlin_activity_resultKt$sam$com_github_florent37_inlineactivityresult_callbacks_SuccessCallback$0.onSuccess(Unknown Source:2)
at com.github.florent37.inlineactivityresult.InlineActivityResult.onReceivedActivityResult(InlineActivityResult.java:113)
at com.github.florent37.inlineactivityresult.InlineActivityResult.access$000(InlineActivityResult.java:29)
at com.github.florent37.inlineactivityresult.InlineActivityResult$1.onActivityResult(InlineActivityResult.java:45)
at com.github.florent37.inlineactivityresult.ActivityResultFragment.onActivityResult(ActivityResultFragment.java:69)
at androidx.fragment.app.FragmentManager$9.onActivityResult(FragmentManager.java:2889)
at androidx.fragment.app.FragmentManager$9.onActivityResult(FragmentManager.java:2869)
at androidx.activity.result.ActivityResultRegistry.doDispatch(ActivityResultRegistry.java:344)
at androidx.activity.result.ActivityResultRegistry.dispatchResult(ActivityResultRegistry.java:308)
at androidx.activity.ComponentActivity.onActivityResult(ComponentActivity.java:618)
at androidx.fragment.app.FragmentActivity.onActivityResult(FragmentActivity.java:164)
at android.app.Activity.dispatchActivityResult(Activity.java:8310)
at android.app.ActivityThread.deliverResults(ActivityThread.java:5008)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5056)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
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:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I am curious how this library is different from https://github.com/Dhaval2404/ImagePicker?
Thanks!
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (resultCode) {
Activity.RESULT_OK -> {
val imageUri = data?.data
iv_selectedimg.setImageURI(imageUri)
fileUri = imageUri
}
ImagePicker.RESULT_ERROR -> {
Toast.makeText(this, ImagePicker.getError(data), Toast.LENGTH_SHORT).show()
finish()
}
else -> {
Toast.makeText(this, "No Image Selected", Toast.LENGTH_SHORT).show()
}
}
}
I was using this with Dhaval's Image Picker
select_image_for_post.setOnClickListener { ImagePicker.with(this) .maxResultSize( 2000,2000) .start() }
This does not seem to work, what changes should I do?
Hi,
I'm facing issue of FileNotFoundException if we use the code without crop(),
Hi! Thanks for the library!
Checked sample app.
Getting BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /document/image:197117: open failed: ENOENT (No such file or directory)
if don't add crop()
ImagePicker.with(this)
// .crop()
// .cropOval()
.maxResultSize(512, 512, true)
.createIntentFromDialog { profileLauncher.launch(it) }
ImagePicker.with(this)
.compress(1024) //Final image size will be less than 1 MB(Optional)
.maxResultSize(1080, 1080) //Final image resolution will be less than 1080 x 1080(Optional)
.start { resultCode, data ->
if (resultCode == Activity.RESULT_OK) {
//Image Uri will not be null for RESULT_OK
val fileUri = data?.data
imgProfile.setImageURI(fileUri)
//You can get File object from intent
val file:File = ImagePicker.getFile(data)
//You can also get File Path from intent
val filePath:String = ImagePicker.getFilePath(data)
} else if (resultCode == ImagePicker.RESULT_ERROR) {
Toast.makeText(context, ImagePicker.getError(data), Toast.LENGTH_SHORT).show()
} else {
Toast.makeText(context, "Task Cancelled", Toast.LENGTH_SHORT).show()
}
}
open failed: EACCES (Permission denied)
Not able to select image from gallery
Device Android 10
minSdkVersion 22
targetSdkVersion 30
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.