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

Does not work with Android 12 (sdk 31)

Open deafol opened this issue 2 years ago • 6 comments

Tried everything in my power (and very restricted Android knowledge) to get the package to work in my react-native project having targetSdkVersion 31 (btw needed to be able to properly run the app with RN 0.70.x on a M1 macbook). Whatever I do and change (upgrade/downgrade dependencies, change manifest settings) I keep getting the same error that boils down to something like:

<project-root>/node_modules/react-native-encrypted-storage/android/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest10103025503043671682.xml:27:9-33:20 Error:
        android:exported needs to be explicitly specified for element <activity#androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

It just seems react-native-encrypted-storage just does not support Android 12, or I don't know how to properly configure it.

So I just hacked the build.gradle like this (line 28)

targetSdkVersion project.properties>  ['EncryptedStorage_targetSdkVersion'].toInteger()

in order to make it build with the package's pre-scripted sdk version (29)

Obviously I would love to see this fixed properly or get help in how to configure it to work. Itmt I can also create a PR to promote this hack, just let me know pls.

deafol avatar Sep 23 '22 11:09 deafol

Same for me, with latest RN 0.70.4, latest node LTS (18.12.1) and NPM 8.19.2.

marcoXbresciani avatar Nov 07 '22 09:11 marcoXbresciani

Same for me, with latest RN 0.70.4, latest node LTS (18.12.1) and NPM 8.19.2.

Update to RN 0.70.5. See this issue.

asdolo avatar Nov 07 '22 14:11 asdolo

Update to RN 0.70.5 does not fix the issue

pawelkiszka avatar Nov 30 '22 20:11 pawelkiszka

This seems to be the only fix that works for me, hopefully it gets merged + released soon

camchis avatar Dec 01 '22 09:12 camchis

Hey, I am upgrading my app from RN v0.68.6 to RN v0.70.7 and I ran into this issue. It wasn't an issue at RN v0.68.6 even though I was targeting Android 12 (31). Any further developments on a solid solution?

ablack34 avatar Feb 06 '23 16:02 ablack34

I am facing the same error on RN v0.72.3 and Android 13. Any solution? For the moment I switched to react-native-async-storage, it works!

MaiconGilton avatar Aug 02 '23 03:08 MaiconGilton