mikehardy / jetifier Goto Github PK
View Code? Open in Web Editor NEWThe jetifier AndroidX transition tool in react-native-friendly npm format
License: MIT License
The jetifier AndroidX transition tool in react-native-friendly npm format
License: MIT License
Thanks for a great tool!
Perhaps this could be supported?
<provider
android:name="android.support.v4.content.FileProvider"
.....
</provider>
To this one
<provider
android:name="androidx.core.content.FileProvider"
......
</provider>
Hey you guys - tagging you so hopefully you'll get a notification:
@m4tt72
@matt-oakes
@rozPierog
I'm writing because we 4 are the group that has write access to this repo and to the package on npmjs.org,
I believe each of us has contributed to this AndroidX migration thing because we want to help our fellow developers and it's fun to make working software
I wanted to say that I'm going to be traveling in pretty remote parts of the world starting on Tuesday and will have intermittent access until August 7th or so.
I think we've done our best to make this utility a high-quality piece of software that should Just Work, and hopefully everything goes smoothly when RN0.60 comes out, so there's nothing to do.
But, if something comes up that seems like it requires a code change or something and you have time to lend a hand I just want to say in advance I trust you to do the right thing. I have a strong bias towards action over waiting for everyone to agree - worst case people use an older version right? - so if you have time and motivation and there's something to do, go ahead and I'm sure it'll work out :-)
I have set the repository to require CI to pass and one PR approval (for me too!) but it could be any 2 of you working together. And if that sucks let me know and I'll change it during one of the times I have connectivity. npm run shipit
will do a release (works best when the main repo is origin
) and that's it.
There is no action required of course - it's volunteer stuff after all, and certainly nothing right now, so I'll close this as soon as I open it. But if you are interested and need a channel to coordinate this issue can serve as that too as well.
Thanks!
i'm currently using RN v.0.59.6, already migrate my project to androidx and so i'm using jetifier. after trying to installDebug by running it with npx react-native run-android, it did success and the aps run just fine. But i found out that there's no app shortcut created on the device.
Then i try to assembleRelease my aps, uploaded to apphost, installed it and the result is the same.
Anyone knows how to fix this?
Thank's for every reply.
Here's my project settings
Android Gradle Plugin Version: 3.4.2
Gradle Version: 5.1.1
android/app/build.gradle
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: "../../node_modules/react-native-sentry/sentry.gradle"
def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.xx"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 6
versionName "0.52.0"
missingDimensionStrategy 'react-native-camera', 'general'
multiDexEnabled true
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':@react-native-firebase_app')
implementation project(':@react-native-firebase_analytics')
implementation project(':react-native-appsflyer')
implementation project(':react-native-code-push')
implementation project(':react-native-device-info')
implementation project(':react-native-sentry')
implementation project(':react-native-image-picker')
implementation project(':react-native-fbsdk')
implementation project(':react-native-google-signin')
implementation project(':react-native-onesignal')
implementation project(':react-native-svg')
implementation project(':react-native-camera')
implementation project(':react-native-vector-icons')
implementation (project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.android.support:multidex:1.0.0'
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.google.android.gms:play-services-auth:${rootProject.ext.googlePlayServicesAuthVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "com.facebook.fresco:animated-gif:1.10.0"
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
implementation "com.google.android.gms:play-services-base:16.0.0"
implementation "com.google.android.gms:play-services-maps:16.0.0"
implementation "com.google.android.gms:play-services-gcm:16.0.0"
implementation "com.google.android.gms:play-services-location:16.0.0"
implementation "com.google.firebase:firebase-core:16.0.9"
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesAuthVersion = "16.0.1"
}
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenLocal()
maven {
url 'https://maven.google.com'
name 'Google'
}
jcenter()
maven {
url "https://jitpack.io"
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
my project dependencies
"dependencies": {
"@react-native-firebase/analytics": "^6.0.3",
"@react-native-firebase/app": "^6.0.3",
"immutable": "3.8.2",
"moment": "^2.24.0",
"react": "16.8.3",
"react-native": "^0.59.6",
"react-native-appsflyer": "^1.4.5",
"react-native-calendars": "^1.208.0",
"react-native-camera": "^2.6.0",
"react-native-code-push": "^5.6.1",
"react-native-countdown-component": "^2.6.0",
"react-native-device-info": "^2.3.2",
"react-native-fbsdk": "^0.8.0",
"react-native-google-maps": "^1.0.0",
"react-native-google-places-autocomplete": "^1.3.9",
"react-native-google-signin": "^2.0.0",
"react-native-image-picker": "^0.28.1",
"react-native-keyboard-aware-scroll-view": "^0.8.0",
"react-native-maps": "^0.24.2",
"react-native-modal-datetime-picker": "^7.4.2",
"react-native-onesignal": "^3.2.12",
"react-native-progress": "^3.6.0",
"react-native-router-flux": "^4.0.6",
"react-native-sentry": "^0.43.2",
"react-native-svg": "^9.4.0",
"react-native-svg-charts": "^5.2.0",
"react-native-vector-icons": "^6.4.2",
"react-redux": "^7.0.2",
"redux": "^4.0.1",
"redux-persist": "^5.10.0",
"redux-thunk": "^2.3.0",
"victory-native": "^32.0.2"
},
Hi guy. i run
npx jetify
and i Can build apk i very happy when see this. But when this run and load JS this have issues
Unable to resolve module scheduler/tracing
from xxx/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js
: Module scheduler/tracing
does not exist in the Haste module map
Hi there.
It's working locally, but I couldn't get it done on CircleCI.
I'm trying patch-package
all the things, but I'm stuck now.
I'm running ./gradlew app:dependencies
trying to track down what's going on
Here's my PR: RocketChat/Rocket.Chat.ReactNative#1095
Here's CI: https://circleci.com/gh/RocketChat/Rocket.Chat.ReactNative/10339
Can you help?
Thank you! :)
I am using few libraries like react-native-fbsdk, react-native-image-picker and so on. First I moved to androidx by changing gradle properties. So I use this library, it does some conversion. But all these third party library are importing android.support.library in their source code. So it is getting build failed. One of the examples are given here. It is happening in react-native-fbsdk.
Hi @m4tt72,
I really appreciate the effort you spent on this tool, last week I integrated with our flow and it allowed us to unlock the issue we were experiencing with some of the deps we have that they haven't migrated to AndroidX yet, but right after we did this, I had to start working on an alternative that could finish the process in less than 5m as this jetifier was taking more than 15m and this was preventing the CI to finish the build.
After spending a couple of days on it, I was finally able to release it publicly Yesterday:
By maintaining an index with all the jetificables under node_modules, and jetifying all of them in parallel time went down from 15m to 8s on the first run (without index), and 1.5s in the following ones (with index).
Thanks again for having open sourced this tool that served me as inspiration to create @jumpn/react-native-jetifier, whenever you have same time, give it a try, it's needless to say that I will very well welcome any feedback :).
source aar used viewbinding when
./jetifier-standalone -r -i xx.aar -o support.aar
WARNING: [CoreRemapperImpl] No mapping for: androidx/viewbinding/ViewBinding
When there is a symlink to the parent folder in the node_modules folder, it will loop indefinitely.
Line 20 in 4e1f119
Not really an issue just a clarification: when should this tool be used in favour of:
I've hit the issue in a React Native project and am confused which way to go to fix it. I'm not sure if this tool predates the 'official' ways or is still needed after in certain circumstances.
Hello,
could you please update your kotlin-stdlib to version 1.3.30 or higher?
In version 1.3.0 is couple of security issues.
CVE-2019-10101
Description: JetBrains Kotlin versions before 1.3.30 were resolving artifacts using an http connection during the build process, potentially allowing an MITM attack.
CVE-2019-10102
Description: JetBrains Ktor framework (created using the Kotlin IDE template) versions before 1.1.0 were resolving artifacts using an http connection during the build process, potentially allowing an MITM attack. This issue was fixed in Kotlin plugin version 1.3.30.
CVE-2019-10103
Description: JetBrains IntelliJ IDEA projects created using the Kotlin (JS Client/JVM Server) IDE Template were resolving Gradle artifacts using an http connection, potentially allowing an MITM attack. This issue, which was fixed in Kotlin plugin version 1.3.30, is similar to CVE-2019-10101.
Thanks in advance
Hi,
I just started to get this (I call npx jetify
), any ideas?
Not Found - GET https://registry.npmjs.org/jetify - Not found
Thank you ๐
@mikehardy first of all, thanks for this library it saves a lot of time :).
Do you know that NPX jetify doesn't change this line in the amplify pushnotification gradle:
// compile "com.android.support:appcompat-v7:23.0.1"
compile "androidx.appcompat:appcompat:1.0.0"
We had to change it manually.
I hope this help someone.
Thanks again!
Matt.
After run npx jetify android run , that is great, but ios build starts failing. Any ideas?
Npx Jetify doesnt affect release builds, only dev ones. Any ideas?
Hi,
I'm building my React Native 0.64 app through App Center. All was working well but I have recently faced the below issue. React Native Track Player seemed to build fine normally but now it's erroring.
Unsure if this is the right place to put this issue but ran out of options.
Thanks!
##[error]Bash wrote one or more lines to the standard error stream.
##[error]Jetifier is deprecated. Future versions of react-native CLI may not run it by default.
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/module/MusicModule.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/module/MusicModule.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/Utils.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/Utils.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/metadata/ButtonEvents.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/metadata/ButtonEvents.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/metadata/MetadataManager.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/metadata/MetadataManager.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/metadata/MetadataManager.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/metadata/MetadataManager.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/models/Track.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/models/Track.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/models/Track.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/models/Track.java
##[error]Jetifier: propose an AndroidX conversion PR to this repository: node_modules/react-native-track-player/android/src/main/java/com/guichaguri/trackplayer/service/player/ExoPlayback.java
I have recently upgraded from RN 0.57.2 to RN 0.61.2.
When I run react-native run-android
, I see:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
In the log messages.
Is run-android
doing exactly what downloading jetifier and running it manually would do? Or is it still necessary or advantageous to download and run jetifier manually?
Currently running jetify can be very slow
There are likely a bunch of methods to speed it up via tools used alone (maybe getting an xargs pipeline or find/exec to work, or switching from shell to multi-threaded javascript or something)
There is an opportunity to only convert things that need converting by maintaining a blacklist of regular expressions not to convert maybe, or alternatively a whitelist of only the regular expressions to convert
Any PRs are welcome
The shell scripts used in this repo should fail fast if commands have non-zero exit status, so that syntax errors and running out of storage space etc. make the scripts have a non-zero exit status too. Otherwise, problems in the scripts won't make the build fail directly.
That means should add this to the top of the shell scripts:
set -o errexit
set -o nounset
set -o pipefail
...and wrap any commands that do have non-zero exit status normally with an "if" (which hides the exit code from errexit).
It's nice to add bash backtraces too if use these shell options, to make it easier to debug failures. I don't have an open-source implementation of this to hand, but there will be many on the web.
Apologies for not making a PR. I've got my own hacky equivalent for this script, so can't justify spending time on testing the change.
vinzscam/react-native-file-viewer#78
I am using [email protected] , AFAIK it migrated to Android X , my react native version is 0.62.2 and in gradle.properties I have
android.useAndroidX=true
android.enableJetifier=true
I package.json I have postinstall
script "postinstall": "jetifier"
After installing react-native-file-viewer and running jetifier , it react-native-file-viewer code to android support
node_modules\react-native-file-viewer\android\src\main\java\com\vinzscam\reactnativefileviewer\RNFileViewerModule.java:57: error: cannot find symbol
contentUri = FileProvider.getUriForFile(getCurrentActivity(), authority, newFile);
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider
If I remove jetifier from postinstall , react-native-file-viewer code is androidx but I have some android support modules and have to enable jetifier
I am using [email protected]
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.+'
}
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 897 file(s) to forward-jetify. Using 4 workers...
jetifxy android/**
this could help react-native bridge package maintainers to easily transform their libraries
Thank you so much for this package! When I run this package in my project I get all these errors below and I am not sure what to do, has anyone encountered similar issues when migrating to AndroidX?
> Task :react-native-navigation:compileReactNative57_5DebugJavaWithJavac FAILED
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/AttachMode.java:3: error: package android.support.annotation does not exist
import android.support.annotation.*;
^
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabPresenter.java:5: error: package android.support.annotation does not exist
import android.support.annotation.*;
^
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabPresenter.java:6: error: package android.support.v4.content does not exist
import android.support.v4.content.*;
^
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/views/SideMenu.java:4: error: package android.support.annotation does not exist
import android.support.annotation.*;
^
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/views/SideMenu.java:5: error: package android.support.v4.widget does not exist
import android.support.v4.widget.*;
^
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/views/SideMenu.java:8: error: cannot find symbol
public class SideMenu extends DrawerLayout {
^
symbol: class DrawerLayout
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/AttachMode.java:54: error: cannot find symbol
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
^
symbol: class VisibleForTesting
location: class AttachMode
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/views/SideMenu.java:9: error: cannot find symbol
public SideMenu(@NonNull Context context) {
^
symbol: class NonNull
location: class SideMenu
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabPresenter.java:33: error: cannot find symbol
defaultSelectedTextColor = defaultOptions.bottomTabOptions.selectedIconColor.get(ContextCompat.getColor(context, com.aurelhubert.ahbottomnavigation.R.color.colorBottomNavigationAccent));
^
symbol: variable ContextCompat
location: class BottomTabPresenter
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabPresenter.java:34: error: cannot find symbol
defaultTextColor = defaultOptions.bottomTabOptions.iconColor.get(ContextCompat.getColor(context, com.aurelhubert.ahbottomnavigation.R.color.colorBottomNavigationInactive));
^
symbol: variable ContextCompat
location: class BottomTabPresenter
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabPresenter.java:75: error: cannot find symbol
public void onComplete(@NonNull Drawable drawable) {
^
symbol: class NonNull
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java:53: error: incompatible types: SideMenu cannot be converted to DrawerLayout
DrawerLayout sideMenu = new SideMenu(getActivity());
^
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/views/SideMenu.java:13: error: method does not override or implement a method from a supertype
@Override
^
/Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/main/java/com/reactnativenavigation/views/SideMenu.java:16: error: cannot find symbol
super.openDrawer(gravity, animate);
^
symbol: variable super
location: class SideMenu
Note: /Users/rezasazesh/Desktop/ReactNativeProjects/EPLInternational/node_modules/react-native-navigation/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/SyncUiImplementation.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
14 errors
FAILURE: Build failed with an exception.
dependencies {
implementation project(':react-native-splash-screen')
implementation project(':react-native-push-notification')
implementation project(':react-native-firebase')
implementation project(':react-native-svg')
implementation project(':react-native-vector-icons')
implementation project(':@react-native-community_netinfo')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.android.support:design:25.4.0'
implementation project(':react-native-navigation')
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation "com.google.firebase:firebase-messaging:17.5.0"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar' // <-- Add this line if you wish to use badge on Android
//compile project(':react-native-code-push')
}
gradle.properties
android.useAndroidX=true
android.enableJetifier=true
android/build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
...
}
"react-native": "0.59.5",
"react-native-code-push": "^5.6.0",
"react-native-elements": "^1.1.0",
"react-native-email": "^1.0.2",
"react-native-firebase": "^5.3.1",
"react-native-global-props": "^1.1.5",
"react-native-navigation": "^2.18.4",
"react-native-push-notification": "^3.1.3",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^9.4.0",
"react-native-vector-icons": "^6.4.2"
renderscript
related mappings do not seem to be in csv
file, since the way to integrate it is different so I guess it is not in the mapping file.
We probably need to add a rule
- android.support.v8.renderscript.*
+ android.renderscript.*
Hey all, first of all let me say this is a really useful library, thanks a lot!
I was using this library for the reverse functionality with the -r flag. It worked as expected, however it missed one import which is androidx.core.util.pair, and I had to manually change it to android.support.v4.util.Pair. This should probably be implemented in master.
Thanks.
$ npx react-native init reproject --template react-native-template-typescript
$ yarn set version berry
$ rm -rf node-modules
Add the following lines to your yarnrc.yml
yarnPath: '.yarn/releases/yarn-berry.cjs'
nodeLinker: 'pnp'
packageExtensions:
'metro-config@*':
dependencies:
'metro-transform-worker': '*'
$ yarn install
$ npx jetify
On run, yarn pnp mode gives the following error:
node:internal/fs/utils:343
throw err;
^
Error: ENOENT: no such file or directory, scandir 'node_modules'
at Object.readdirSync (node:fs:1381:3)
at NodeFS.readdirSync (F:\pkgs\RNSlider\.pnp.js:12887:26)
at makeCallSync.subPath.subPath (F:\pkgs\RNSlider\.pnp.js:15683:26)
at ZipOpenFS.makeCallSync (F:\pkgs\RNSlider\.pnp.js:15783:26)
at ZipOpenFS.readdirSync (F:\pkgs\RNSlider\.pnp.js:15682:17)
at VirtualFS.readdirSync (F:\pkgs\RNSlider\.pnp.js:13178:24)
at PosixFS.readdirSync (F:\pkgs\RNSlider\.pnp.js:13178:24)
at readDir (F:\pkgs\RNSlider\.yarn\unplugged\jetifier-npm-2.0.0-c3dff52ce1\node_modules\jetifier\src\utils.js:14:17)
at Object.<anonymous> (F:\pkgs\RNSlider\.yarn\unplugged\jetifier-npm-2.0.0-c3dff52ce1\node_modules\jetifier\index.js:12:15)
at Module._compile (node:internal/modules/cjs/loader:1109:14) {
errno: -4058,
syscall: 'scandir',
code: 'ENOENT',
path: 'node_modules'
}
Just a heads-up, I got this report, didn't test myself. Sorry if it's not the case ๐ข
๐ค
react-native-maps/react-native-maps#2839 (comment)
It seems that this library by design reads java files, xml files and kotlin files - but not build.gradle-files. This causes my project to not convert properly, since I have the following modules that aren't updated:
// react-native-cross-geolication:
implementation "com.android.support:appcompat-v7:${_supportLibVersion}"
// react-native-maps:
implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '28.0.0')}"
// react-native-camera:
implementation "com.android.support:exifinterface:${safeExtGet('supportLibVersion', '27.1.0')}"
implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '27.1.0')}"
implementation "com.android.support:support-v4:${safeExtGet('supportLibVersion', '27.1.0')}"
The refactoring tool in Android Studio catches these, and changes the files respectively to:
// react-native-cross-geolication:
implementation "androidx.appcompat:appcompat:${_supportLibVersion}"
// react-native-maps:
implementation "androidx.appcompat:appcompat:1.0.0-beta01"
// react-native-camera:
implementation "androidx.exifinterface:exifinterface:1.0.0-beta01"
implementation "androidx.annotation:annotation:1.0.0-beta01"
implementation "androidx.legacy:legacy-support-v4:1.0.0-beta01"
I can of course manually run the refactoring tool in Android Studio when required, but maybe there's a way to make this tool handle these cases as well?
I'm trying to install jetifier using the steps described in readme.
I've converted my app to AndroidX via the standard AndroidX migration in Android Studio refactor menu.
I've run npm install --save-dev jetifier
, it completed successfully.
When I run npx jetify
I get the following error:
ENOENT: no such file or directory, stat 'node_modules/fsevents/node_modules/.bin/node-pre-gyp'
I've also tried uninstalling the dev dependency and installing it globally but no avail.
What am I doing wrong?
Hello, when I try to execute the npx jetify
command, I get the following messages:
npx: installed 1 in 3.973s
Path must be a string. Received undefined
location\appName\node_modules\jetifier\bin\jetify
Jetifier found 1087 file(s) to forward-jetify. Using 4 workers...
I'm not sure if that should be like that
Followed the instructions with both yarn and npm.
With yarn:
yarn add --dev jetifier
yarn run jetify
error: The system cannot find the path specified. error Command failed with exit code 1.
With npm:
npm install --save-dev jetifier
npx jetify
error: The system cannot find the path specified.
any idea why i'm experiencing this..
Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :blinkid-react-native
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > com.facebook.react:react-native:0.60.3
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > project :react-native-fbsdk
Could not find androidx.appcompat:appcompat:28.0.0.
Required by:
project :app > com.facebook.android:facebook-android-sdk:4.22.1
I also attached the one i'm encountering when running using android studio :( NOT sure if the issues are both related.. i use jetifier when I migrated
Running npx jetify
exits with error on MacOS:
/node_modules/.bin/jetify: line 50: wait: -n: invalid option
wait: usage: wait [n]
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
npm ERR! code ETARGET
npm ERR! notarget No matching version found for [email protected]
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'faye-websocket'
npm ERR! notarget
it would be cool to run jetify
on all node_modules of a yarn monorepo
Hi @mikehardy, thanks for this tool!
I was wondering if you can help me to identify what changes I need to revert to use this tool instead of having breaking changes?
I'm the maintainer of this library: proyecto26/react-native-inappbrowser@8a083f2#diff-7ae5a9093507568eabbf35c3b0665732
Thanks in advance ๐
For some reason GridLayoutManager is not being converted correctly with jetifier. After running 'npx jetify' the import statement is converted to:
'import androidx.gridlayout.widget.GridLayoutManager;' instead of
'import androidx.recyclerview.widget.GridLayoutManager;'
Package where error surfaced: react-native-photo-editor
I wanted to alert you to an area where your library may be able to be improved. I used your library on a react-native package, and was receiving a build error about not being able to resolve DrawerLayout. After investigating, I discovered that the library prefix was changed from android.support.v4.widget to androidx.drawerLayout.widget. The import statement imported android.support.v4.widget.* which got translated to androidx.core.widget. I noticed that there were several other widgets that also had their prefix changed to something other than core. If it is possible to check the file for the use of these outliers and add the correct imports, then it could prevent other users from facing the same issue.
This is a great tool, it would be good if windows were also supported, right now I am getting the following error:
npx jetify
The system cannot find the path specified.
Thanks!
I'm getting the above error i'm running jetify against my project and can see its changing imports to androidx
not sure whats needed to fix the top error:
Could not find androidx.appcompat:appcompat:26.1.0.
Could not determine the dependencies of task ':app:preQaReleaseBuild'.
> Could not resolve all task dependencies for configuration ':app:qaReleaseRuntimeClasspath'.
> Could not find androidx.appcompat:appcompat:26.1.0.
Required by:
project :app
> Could not find androidx.appcompat:appcompat:26.1.0.
Required by:
project :app > project :react-native-share
project :app > project :react-native-webview
project :app > project :lottie-react-native
> Could not find androidx.legacy:legacy-support-v4:26.1.0.
Required by:
project :app > project :react-native-firebase
project :app > project :react-native-camera
> Could not find androidx.exifinterface:exifinterface:26.1.0.
Required by:
project :app > project :react-native-camera
> Could not find androidx.annotation:annotation:26.1.0.
Required by:
project :app > project :react-native-camera
> Could not find androidx.appcompat:appcompat:26.1.0.
Required by:
project :app > project :react-native-splash-screen
> Could not find androidx.browser:browser:26.1.0.
Required by:
project :app > project :react-native-auth0
> Could not find androidx.appcompat:appcompat:26.1.0.
Required by:
project :app > com.facebook.react:react-native:0.59.4
project :app > project :lottie-react-native > com.airbnb.android:lottie:2.5.6
> Could not find androidx.legacy:legacy-support-v4:26.1.0.
Required by:
project :app > project :react-native-onesignal > com.onesignal:OneSignal:3.10.3
project :app > project :react-native-pdf > com.github.barteksc:android-pdf-viewer:3.1.0-beta.1 > com.github.barteksc:pdfium-android:1.9.0
> Could not find androidx.browser:browser:26.1.0.
Required by:
project :app > project :react-native-onesignal > com.onesignal:OneSignal:3.10.3
> Could not find androidx.annotation:annotation:26.1.0.
Required by:
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.core:core:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.collection:collection:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-utils:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.core:core:1.0.0 > androidx.lifecycle:lifecycle-runtime:2.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.core:core:1.0.0 > androidx.versionedparcelable:versionedparcelable:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.loader:loader:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.lifecycle:lifecycle-viewmodel:2.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-utils:1.0.0 > androidx.documentfile:documentfile:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-utils:1.0.0 > androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-utils:1.0.0 > androidx.print:print:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.core:core:1.0.0 > androidx.lifecycle:lifecycle-runtime:2.0.0 > androidx.lifecycle:lifecycle-common:2.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.core:core:1.0.0 > androidx.lifecycle:lifecycle-runtime:2.0.0 > androidx.arch.core:core-common:2.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.customview:customview:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.viewpager:viewpager:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.coordinatorlayout:coordinatorlayout:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.drawerlayout:drawerlayout:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.slidingpanelayout:slidingpanelayout:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.interpolator:interpolator:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.legacy:legacy-support-core-ui:1.0.0 > androidx.cursoradapter:cursoradapter:1.0.0
project :app > com.google.android.gms:play-services-base:17.0.0 > androidx.fragment:fragment:1.0.0 > androidx.loader:loader:1.0.0 > androidx.lifecycle:lifecycle-livedata:2.0.0 > androidx.arch.core:core-runtime:2.0.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 26s
my
android/app/build.gradle
dependencies {
...
implementation "androidx.appcompat:appcompat:1.0.+"
}
gradle.properties
android.enableJetifier=true
android.useAndroidX=true
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "1.0.0"
}
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven { url "https://jitpack.io" }
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
AndroidManifest.xml
<manifest
xmlns:tools="http://schemas.android.com/tools"
...>
<application
android:appComponentFactory="androidx"
tools:replace="android:appComponentFactory"
...>
any help guidance will be very much appreciated :) thanks for the tool you are a saviour!
Add Ability to specify custom folder where to run jetify.
Currently the tool fails if try to run on any non node_modules directory.
I have a doubt, after executing npx jetify is solves all the problems of react-native-firebase and everything is working ok but in the gradle library i saw this line which I suspect isnt compatible with androidX ?
...
// For React Native Firebase Notifications
api "com.android.support:support-v4:$supportVersion"
...
it suppose that I have to change this manually? or I am missing something ?
Again: besides this line everything seems to work okay.
Thanks for your support to the community.
Matt.
This may not seem important, but if you maintain a library that users depend on, and they can't convert to AndroidX yet, then you either maintain a fork (terrible as a library maintainer), or you publish an AndroidX version and recommend they use npx reverse-jetify
on your library
Similar to the performance needs of #3 this should take a whitelist or blacklist or something as a config (or just work so fast it doesn't matter)
Hi there,
Before moving forward I want to thank you for having created this package!
I currently don't have the time to fork and send you a PR, but I'm opening this one so next time you push something you consider adding to README a recommendation of running jetify in the postinstall script, so this way you won't need to manually run jetify each time you add/remove a package.
Unfortunately jetifier can't solve all your problems. Here are some reasons it could fail:
- You have a dependency that packages things in violation of Android packaging rules, like including an extra AndroidManifest.xml or similar: Clip-sub/react-native-bottomsheet#23 - this will lead to dex merger issues about duplicate entries. Open pull requests with the libraries that do this.
I have one customer project (React Native v0.59.9) that depends on jetify to work but has one node_module that has its own AndroidManifest.xml file. There is any way to run jetify without affect only this module? Any flag / config that may ignore the process to one particular module?
It would be good to have more control of where and how jetify runs in the whole project. Already tried on gradle level (things such as blacklist) and we still getting the same error:
Duplicate class org.spongycastle.util.encoders.Base64 found in modules core-1.51.0.0.jar (com.madgag.spongycastle:core:1.51.0.0) and jetified-vpnsdk-3.6.8-runtime.jar (com.datami:vpnsdk:3.6.8)
Duplicate class org.spongycastle.util.encoders.Base64Encoder found in modules core-1.51.0.0.jar (com.madgag.spongycastle:core:1.51.0.0) and jetified-vpnsdk-3.6.8-runtime.jar (com.datami:vpnsdk:3.6.8)
Duplicate class org.spongycastle.util.encoders.Encoder found in modules core-1.51.0.0.jar (com.madgag.spongycastle:core:1.51.0.0) and jetified-vpnsdk-3.6.8-runtime.jar (com.datami:vpnsdk:3.6.8)
Duplicate class org.spongycastle.util.io.pem.PemGenerationException found in modules core-1.51.0.0.jar (com.madgag.spongycastle:core:1.51.0.0) and jetified-vpnsdk-3.6.8-runtime.jar (com.datami:vpnsdk:3.6.8)
Duplicate class org.spongycastle.util.io.pem.PemHeader found in modules core-1.51.0.0.jar (com.madgag.spongycastle:core:1.51.0.0) and jetified-vpnsdk-3.6.8-runtime.jar (com.datami:vpnsdk:3.6.8)
Duplicate class org.spongycastle.util.io.pem.PemObject found in modules core-1.51.0.0.jar (com.madgag.spongycastle:core:1.51.0.0) and jetified-vpnsdk-3.6.8-runtime.jar (com.datami:vpnsdk:3.6.8)
Duplicate class org.spongycastle.util.io.pem.PemObjectGenerator found in modules core-1.51.0.0.jar (com.madgag.spongycastle:core:1.51.0.0) and jetified-vpnsdk-3.6.8-runtime.jar (com.datami:vpnsdk:3.6.8)
Duplicate class org.spongycastle.util.io.pem.PemReader found in modules core-1.51.0.0.jar (com.madgag.spongycastle:core:1.51.0.0) and jetified-vpnsdk-3.6.8-runtime.jar (com.datami:vpnsdk:3.6.8)
Duplicate class org.spongycastle.util.io.pem.PemWriter found in modules core-1.51.0.0.jar (com.madgag.spongycastle:core:1.51.0.0) and jetified-vpnsdk-3.6.8-runtime.jar (com.datami:vpnsdk:3.6.8)
Go to the documentation to learn how to Fix dependency resolution errors.
I ran into an issue with trying to use npx jetify as a postinstall script within docker. The problem here is that for some reason, the node_modules end up being owned by a different user, or nobody, or whatever, and that means that npm will throw an ambigious error of cannot run in wd <package> npx jetify
.
The simple fix is to add RUN npm set unsafe-perm true
to the dockerfile before an npm (or friends) install
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.