Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native run-android builds an old version of the code onto device

This occurs in both production and dev builds. I can connect to the dev server, reload, and the new code is built and runs on the device.

Step-by-step of what I have tried:

  1. Modify code.

  2. Re-bundle:

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

  1. ./gradlew clean

  2. react-native run-android - Builds old version

  3. react-native run-android --variant=release - Builds old version

Is there any way to completely wipe the android build and build from scratch? My gut tells me that run-android is not performing a full clean build.

like image 438
Biiiiiird Avatar asked Dec 29 '17 08:12

Biiiiiird


People also ask

What does React Native run Android do?

React Native (also known as RN) is a popular JavaScript-based mobile app framework that allows you to build natively-rendered mobile apps for iOS and Android. The framework lets you create an application for various platforms by using the same codebase.

Is React Native compatible with Android?

React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces. Use a little—or a lot. You can use React Native today in your existing Android and iOS projects or you can create a whole new app from scratch.


1 Answers

  1. Delete files inside directory android/app/src/main/assets.
  2. run $ react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
  3. $ react-native run-android
like image 180
Gamma Ko Avatar answered Oct 11 '22 09:10

Gamma Ko