react-native-async-storage / async-storage

An asynchronous, persistent, key-value storage system for React Native.
https://react-native-async-storage.github.io/async-storage/
MIT License
4.74k stars 467 forks source link

Android: Support Kotlin 1.7 #832

Closed tido64 closed 1 year ago

tido64 commented 2 years ago

@tido64 so the problem is that test-app has bumped to Kotlin 1.7. So we have to solutions:

With first one, it's hard to assess how much of impact it would be on project that'd depend on AsyncStorage, which are still on lower version of Kotlin. It'd be good to test this KSP integration with lower Kt version to see if it's still compatible.

Second one has drawback of Room requiring compilation/target sdk of 32. That means developer should migrate in project to those version and check compatibility of the rest of the app.

I'd be in favor on going with first approach, but would have to test the scenario first.

Originally posted by @krizzu in https://github.com/react-native-async-storage/async-storage/issues/823#issuecomment-1191449138

izyspania commented 2 years ago

Works with 2.5.0-alpha03 but im getting this:

node_modules\@react-native-async-storage\asyncstorage\android\build\tmp\kapt3\stubs\debug\com\reactnativecommunity\asyncstorage\next\StorageDb.java:7: warning: Schema export directory is not provided to the annotation processor so we cannot export the schema. You can either provide room.schemaLocation annotation processor argument OR set exportSchema to false. public abstract class StorageDb extends androidx.room.RoomDatabase { ^ and i have to use this for release ( sdk 33 , gradle:4.2.2, jdk 11 or15, kotlinVersion 1.6.10 or 1.7.10 )

android.jetifier.blacklist=bcprov

Failed to transform bcprov-jdk15on-1.68.jar (org.bouncycastle:bcprov-jdk15on:1.68) to match attributes {artifactType=processed-jar, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.

Execution failed for JetifyTransform: C:\Users\me.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcprov-jdk15on\1.68\46a080368d38b428d237a59458f9bc915222894d\bcprov-jdk15on-1.68.jar. Failed to transform 'C:\Users\me.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcprov-jdk15on\1.68\46a080368d38b428d237a59458f9bc915222894d\bcprov-jdk15on-1.68.jar' using Jetifier. Reason: IllegalArgumentException, message: Unsupported class file major version 59. (Run with --stacktrace for more details.) Suggestions:

izyspania commented 2 years ago

Any idea if we can do something about that? (or im doing something wrong)

krizzu commented 2 years ago

@izyspania quick search told me that it's related to JDK15 usage on your machine and the solution could be to add android.jetifier.blacklist=bcprov-jdk15on to your gradle.properties file

izyspania commented 2 years ago

Well yes , it works with android.jetifier.blacklist=bcprov-jdk15on but i was trying to figure out if it can be fixed somehow without this workaround, i tried with jdk11 and jdk15 both having the same problem.

Edit: Going with gradle 7+ seems to fix the problem but i still have to bumb sdk to 33 with 2.5.0-alpha02

Edit2: Seems to work with room 2.4.3

krizzu commented 1 year ago

New release, v1.18.0 addresses this issue. Please check it out 🙏