0
votes

I'm trying to migrate my app on 0.60, but it keeps getting stuck on jetify process.

Basically, after this line:

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.

It's just stuck and does nothing. And I need jetifier for react-native-firebase and some other native libraries. Any suggestions?

Update

It seems the problem is in symlinks. I'm using Lerna.

2

2 Answers

1
votes

In the end what I did was rewriting a jetify specifying which modules I need to jetify.

My jetify index.js:

const {fork} = require('child_process');
const {join} = require('path');
const {getClassesMapping, readDir, chunk} = require('./src/utils');

const cpus = require('os').cpus().length;

const arg = process.argv.slice(2)[0];
const mode = arg && (arg === 'reverse' || arg === '-r') ? 'reverse' : 'forward';
const SEARCH_DIRS = [
  ........modules here
];

const classesMapping = getClassesMapping();
for (const SEARCH_DIR of SEARCH_DIRS) {
  const files = readDir(SEARCH_DIR);

  console.log(
    `Jetifier found ${
      files.length
    } file(s) to ${mode}-jetify. Using ${cpus} workers...`,
  );

  for (const filesChunk of chunk(files, cpus)) {
    const worker = fork(join(__dirname, 'src', 'worker.js'));
    worker.send({filesChunk, classesMapping, mode});
  }
}

And postinstall in package.json:

"postinstall": "cp ./jetify.js ./node_modules/jetifier/index.js"
0
votes

There is also one more situation when the npx react-native run-android stucks at jetifying state

If you run npm run android it'll start the metro server as well,

However, to re-run npm run android, you need to close the metro command window and allow npm run android to start a new metro server