Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm run android hangs on 'Loading dependency graph, done' (BlueWallet)

I'm trying to clone BlueWallet from this github source.

I clone the project and installed the required packages. Also, the emulator is running with android studio AVD.

But whenever I try to run npm start android it hangs on text Loading dependency graph, done. and nothing more will happen!

it's weird because whenever I try to run the same scenario and commands to start a pure react-native connected to emulator it works with no problem.

the result for npm start android is as follow:

$ npm start android

> [email protected] start /home/Learning/ReactNative/BlueWallet
> node node_modules/react-native/local-cli/cli.js start "android"

   ┌─────────────────────────────────────────────────────────────────────────────        ─┐
│                                                                                  │
│  Running Metro Bundler on port 8081.                                             │
│                                                                                  │
│  Keep Metro running while developing on any JS projects. Feel free to            │
│  close this tab and run your own Metro instance if you prefer.                   │
│                                                                                  │
│  https://github.com/facebook/react-native                                        │
│                                                                                  │
└─────────────────────────────────────────────────────────────────────────────    ─┘

Looking for JS files in
   /home/Learning/ReactNative/BlueWallet 

Loading dependency graph, done.
like image 677
Reza Torkaman Ahmadi Avatar asked Mar 08 '19 17:03

Reza Torkaman Ahmadi


Video Answer


1 Answers

I found the solution myself. Actually Loading dependency graph, done is not actually a bug and the server doesn't hang on anything. It's just waiting for the emulator to connect to it.

Here is what I did:

  • In a separate terminal, I did run npm start, this way the server (packager) is starting.

  • In another terminal, I run npm run android. Now the emulator will be selected and will connect on the port of 8081 which the server from the first command is running and everything will be fine.

Note: I did make some twists on some parts of the project and did something on OS as follow. If anyone in the future wanted to do the same, maybe be useful for him:

  • set java home variable to be correct (add it to bashrc or profile or ..)

    export JAVA_HOME="/usr/lib/jvm/java-10-openjdk"
    export PATH=$JAVA_HOME/bin:$PATH
    
  • set android SDK and other env variables;

    export ANDROID_HOME=/home/execut3/android-sdk
    export ANDROID_SDK_ROOT=/home/execut3/android-sdk
    export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
    export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$PATH
    
  • to run emulator

    $ emulator -list-avds
    $ emulator -avd <avd name>
    
  • If error Execution failed for task ':app:compileDebugJavaWithJavac' react native happened, in android/app/src/main/java/com/bluewallet/MainApplication.java in line 19, change it to return true to ignore debug. Also, this link could be useful too.

  • add google() repository in higher place than other in android/build.gradle file.

  • change version of react-native to 0.57.5 in package.json file and remove node_modules then install again.

like image 75
Reza Torkaman Ahmadi Avatar answered Nov 14 '22 12:11

Reza Torkaman Ahmadi