Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "jetifier", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "jetifier from Android Studio, in npm package format", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"scripts": { | ||
"dev-sync": "cp -rv bin index.js lib package.json src ../../Kullki/kscoreapp-rxp/node_modules/jetifier", | ||
"dev-sync": "cp -rv bin index.js lib package.json src ../rn-androidx-demo/rnandroidxdemo/node_modules/jetifier", | ||
"shipit": "np", | ||
@@ -14,0 +14,0 @@ "test": "" |
# jetifier | ||
The jetifier-standalone command-line utility from Android Studio, in npm package format | ||
The jetifier AdnroidX transition tool in npm format, with a react-native compatible style | ||
@@ -21,16 +21,32 @@ ## Usage for jar/zip/aar files | ||
If there was a way to take your react-native dependencies and convert them, then you could convert your app and use AndroidX dependencies. | ||
If there was a way to take your react-native dependencies and convert them, then you could convert your app and use AndroidX dependencies. | ||
**There is a way**. | ||
1. Make sure your app is AndroidX (this is documented elsewhere but is just a refactor in Android Studio) | ||
1. `npm install jetifier` (or use yarn, or install it globally - just install the package) | ||
1. `npm install --save-dev jetifier` (or use yarn, but install it locally in your project, not globally) | ||
1. `npx jetify` | ||
1. Get a cup of coffee, it takes a while. Performance improvements can come later. | ||
1. `npx react-native run-android` (this should compile and work) | ||
1. If it works, you should hook an `npx jetify` run in the postinstall target of your package.json so you don't forget to run it after installing or updating packages. There will be performance improvements soon (I think) which will make this less painful | ||
Please note that any time you install a new dependency, or reinstall node modules, you will need to run `npx jetify` again. | ||
I demonstrate exactly this with a huge pile of native modules here: <https://github.com/mikehardy/rn-androidx-demo>. You can clone that repo, run the script, and see it works. Please feel to make PRs to that repo, especially in App.js or in the dependencies included, if you would like to demonstrate success or failure for a specific module. | ||
*Inspiration:* this jetify command was based on [an idea](https://gist.github.com/janicduplessis/df9b5e3c2b2e23bbae713255bdb99f3c) from @janicduplessis - thank you Janic! | ||
## Troubleshooting | ||
Unfortunately jetifier can't solve all your problems. Here are some reasons it could fail: | ||
1. You have a dependency that packages things in violation of Android packaging rules, like including an extra AndroidManifest.xml or similar: <https://github.com/acaziasoftcom/react-native-bottomsheet/pull/23> - this will lead to dex merger issues about duplicate entries. Open pull requests with the libraries that do this. | ||
1. You have a dependency that does not allow overrides of compileSdk, so you can't set the compileSdk to 28 as AndroidX requires: <https://github.com/razorpay/react-native-razorpay/pull/201>. This can lead to errors in resource merger where styles reference unknown attributes. Open pull requests with the libraries that do this | ||
1. For windows you must use WSL - we have reports it works, but also reports you may need to update WSL and install jetifier locally vs globally. It should work for you, but if you have updates to exactly how to make it work please propose a PR to this readme :hearts: | ||
- from one of the success reports "installed jetifier from the Windows console, then I ran the the jetify command from WSL" | ||
So far there has not been a case of `npx jetify` failing that wasn't based in an error in a library, so if you have a problem please examine the error and the dependency very closely and help the libraries with fixes. | ||
## Contributing | ||
Please feel free to pull requests or log issues, especially to update versions if I somehow fail to notice an update. Thanks! |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2724819
52