react-native-encrypted-storage icon indicating copy to clipboard operation
react-native-encrypted-storage copied to clipboard

Update androidx.test.ext:junit version

Open emanuelboros opened this issue 2 years ago • 11 comments

This fixes an error while building ui test apk version with targetSdkVersion:31

emanuelboros avatar May 11 '22 12:05 emanuelboros

@emeraldsanto Can you take a look on this?

emanuelboros avatar May 13 '22 07:05 emanuelboros

@emeraldsanto +1 for this, it is required for targetAndroidSDK 31. Running into issues building a testbuild with Detox. Can confirm this fixes it.

I followed this stackoverflow answer https://stackoverflow.com/a/71605255/913824

Marthyn avatar Jul 07 '22 07:07 Marthyn

@emeraldsanto We have bumped up our targetSdkVersion to 31 and running into issues as well, can confirm this fixes the test errors we are getting.

camchis avatar Nov 30 '22 12:11 camchis

+1, please take a look

Gerjan98 avatar Dec 02 '22 15:12 Gerjan98

@emeraldsanto can we get this merged?

gregmarut avatar Dec 28 '22 20:12 gregmarut

@emanuelboros @monostere0 @hssrrw @mlowijs @alesharik Can someone from the contributors plz merge that

GeorgeNiotis avatar Feb 15 '23 20:02 GeorgeNiotis

In the meantime, I fixed this locally for my project with patch-package (https://www.npmjs.com/package/patch-package)

diff --git a/node_modules/react-native-encrypted-storage/android/build.gradle b/node_modules/react-native-encrypted-storage/android/build.gradle
index b762894..e4f213d 100644
--- a/node_modules/react-native-encrypted-storage/android/build.gradle
+++ b/node_modules/react-native-encrypted-storage/android/build.gradle
@@ -125,7 +125,7 @@ dependencies {
 
   testImplementation 'junit:junit:4.13.1'
 
-  androidTestImplementation 'androidx.test.ext:junit:1.1.2'
+  androidTestImplementation 'androidx.test.ext:junit:1.1.3'
   //noinspection GradleDependency
   androidTestImplementation 'org.mockito:mockito-android:3.4.6'
   androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

gregmarut avatar Feb 15 '23 21:02 gregmarut

Unfortunately this still stands in the open state. Maybe @emeraldsanto will reply to us why? There was activity on this particulary library since this fix was created.

We needed this fix quite urgently in our project so I would sugest to use what @gregmarut sugested, or create a fork and use it your own fork.

emanuelboros avatar Feb 15 '23 21:02 emanuelboros

This needs to be updated again to a new version. 1.1.5

https://github.com/emeraldsanto/react-native-encrypted-storage/issues/110

px-amaac avatar Mar 14 '23 03:03 px-amaac

@px-amaac @JordaoViktor
@everyoneelse

  1. As mentioned in my last comment regarding this PR, you should do it yourselfs as a patch. But now reconsidering everything I would not recomend using this package anymore. Not mentained anymore at all

try using other packages instead, search for mmkv. That seems to be the best alternative atm, and they claim it's the fastest storage and offers even sync calls not only async.

emanuelboros avatar Apr 05 '23 12:04 emanuelboros

Made a workaround.

Hi @emanuelboros and @everyonelse, I added this to my postinstall script under scripts in package.json (yarn) so that on every yarn install, it automatically replaces the outdated version with the newer one.

Made it with node instead of a shell command to avoid issues with varying OS.

"postinstall": "node -e \"const fs = require('fs'); const content = fs.readFileSync('node_modules/react-native-encrypted-storage/android/build.gradle', 'utf-8'); const modifiedContent = content.replace(/androidTestImplementation 'androidx.test.ext:junit:1.1.2'/g, 'androidTestImplementation \\'androidx.test.ext:junit:1.1.5\\''); fs.writeFileSync('node_modules/react-native-encrypted-storage/android/build.gradle', modifiedContent, 'utf-8');\""

image

coderaven avatar Jul 17 '23 19:07 coderaven