plugins icon indicating copy to clipboard operation
plugins copied to clipboard

@nativescript/imagepicker does not show selected image after app is build in release mode

Open leocrawf opened this issue 1 year ago • 8 comments

I am having an issue now where @nativescript/imagepicker works perfectly when I do ns run android, wherein I am able to see the images in their respective folders and make a selection and the selected image is shown in my ui as the selected image. However, after I do a ns build releease .... the apk or aab file does not show the selected image. I am able to see the images list in their respective folders, make a selection but then it does not appear in my ui as selected, as If I had selected nothing. My package.json is as shown before:

"dependencies": { "@nativescript-community/drawingpad": "^4.1.0", "@nativescript-community/https": "^4.1.8", "@nativescript-community/perms": "^2.3.0", "@nativescript/appavailability": "^2.0.0", "@nativescript/background-http": "^6.0.0", "@nativescript/core": "~8.6.0", "@nativescript/directions": "^2.0.2", "@nativescript/email": "^2.1.0", "@nativescript/imagepicker": "^3.0.1", "@nativescript/social-share": "^2.3.0", "@nativescript/theme": "~3.0.2", "@nstudio/nativescript-carousel": "^8.0.3", "@nstudio/nativescript-checkbox": "^2.0.5", "@nstudio/nativescript-loading-indicator": "^4.3.4", "@triniwiz/nativescript-image-cache-it": "^7.4.0", "@triniwiz/nativescript-toasty": "^4.1.3", "moment": "^2.30.1", "nativescript-audio": "^6.2.6", "nativescript-feedback": "^2.0.0", ... }, "devDependencies": { "@nativescript/android": "8.6.2", "@nativescript/webpack": "~5.0.18" }

and the relevant settings in my AndroidManifest are: <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" tools:replace="android:maxSdkVersion"/>

The relevant part of my app.gradle is: android { compileSdkVersion 33 buildToolsVersion "33" defaultConfig { minSdkVersion 23 targetSdkVersion 33 versionCode 10074 }

I am using open jdk 14.

leocrawf avatar Feb 14 '24 09:02 leocrawf

I got the same problem.Finally, i solved this problem with following way, just downgrade version to v1.0.10, then it work properly.

hw-barry avatar Feb 17 '24 04:02 hw-barry

Downgrading the package did not help as the permissions would no longer work on Android13+. PS: The problem affects only the recent versions of Android, works on 7 or 10.

IvanTonchev avatar Apr 19 '24 13:04 IvanTonchev

to solve the issue i had to get help from the native script discord. i recommend that you join.

leocrawf avatar Apr 19 '24 13:04 leocrawf

@leocrawf could you share here what was the solution that you got in the discord ?

pabloposada09 avatar Apr 30 '24 17:04 pabloposada09

@leocrawf What was the solution? I am seeing this problem too.

insytes avatar Jun 07 '24 11:06 insytes

Using imagepicker 3.1.1, and following the advice from the discord discussion, i managed to get it working by adding this line to my app.gradle dependencies:

implementation("androidx.documentfile:documentfile:1.0.1")

Like this (some lines omitted for brevity):

android { dependencies { constraints { ... } implementation("androidx.documentfile:documentfile:1.0.1") } ... }

IvanTonchev avatar Jun 07 '24 12:06 IvanTonchev

@IvanTonchev brilliant, thanks for your help 👍🏻

insytes avatar Jun 07 '24 14:06 insytes

#551 related

PixsaOJ avatar Sep 04 '24 00:09 PixsaOJ