npx jetify -r does not working
I want to use react-native-inappbrowser-reborn that already migrate to use AndroidX and I'm still on RN 0.59.10.
I've installed the library and also jetifier. after running npx jetify -r command in project's root it shows me message below:
Jetifier found 3784 file(s) to reverse-jetify. Using 8 workers...
and after about 2 seconds it terminates. but when I check react-native-inappbrowser-reborn's gradle file it still remains unchanged and using androidx.
the gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.facebook.react:react-native:+'
implementation 'androidx.annotation:annotation:1.+'
implementation 'androidx.browser:browser:1.+'
implementation 'org.greenrobot:eventbus:3.+'
}
jetifier does not modify gradle files, they library will have to include backwards-compatible support as mentioned in the module maintainers section - here's an example https://github.com/react-native-community/react-native-device-info/commit/d448d872906335813d53a7e8f8dc7860ae160c40
(you can do something like this and use patch-package to get your build working, FWIW - that's how I usually operate while waiting for a PR to be merged upstream)
Just one more question. Jetifier does not modify gradle files at all? or just in reverse mode?
Not at all, Google hasn't provided a mapping as it is different for different use cases
@mikehardy I guess I don't understand:
- When you run the Refactor -> Migrate to AndroidX in Android Studio, it's doing file rewrites (in that case, you can review the refactor. But the default refactor seems to work for me usually without edits).
- And, you say in the Jetifier NPM doc "That is what this tool does - it can rewrite the source in node_modules every time you call it."
- But above you are saying it does not modify files. So... what DOES it do?
Edit: I missed that you are supposed to use the Studio tool first. So I'm guessing Jetifier is just kindof like patch-package, where it stores those updates and re-applies them?
No, jetifier literally scans the whole tree every time you run it, and applies "the standard transform" (literally the file from google of what transforms to what - you can check the SHA256 of the file) plus a couple extras that are necessary. Every time, in node_modules tree.
https://github.com/mikehardy/jetifier/blob/master/mapping/androidx-class-mapping.csv
@mikehardy sorry but something's not clear to me So if you don't want to migrate to AndroidX yet, and you choose to reverse jetify some package (in my case: react-native-camera) Should you skip the 1st step (Refactor -> Migrate to AndroidX in Android Studio), or you still need it?
Hi @realesh ! AndroidX conversion is a binary thing, all one way or all the other way. If you want to stay on support libraries (not AndroidX) then you will use jetify -r and you will not migrate to androidx in android studio
I just re-read that section and it was confusing, I changed it a bit, is it more clear now @realesh ?
@mikehardy Yes it's more clearer now indeed! Thx a lot :+1: