0

I am using two methods to build an APK in React Native project.

  1. using react-native run-android and take the latest apk from projectFolder>android>app>build>output>apk.
  2. react-native bundle --dev false --platform android --entry-file index.android.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug

then run:

cd android
gradlew assembleDebug

then physically locate the file at android/app/build/outputs/apk folder:

app-debug.apk
app-debug-unaligned.apk

The problem I am facing is that if I am building apk from above-mentioned methods then generated apk is not the build of updated code. But the same code which I am running on the Android simulator of Android Studio is working perfectly. Also if I am using a real device as an emulator connected to the android studio, it's running on the older version of build.

halfer
  • 19,824
  • 17
  • 99
  • 186
rohit kumar
  • 81
  • 12
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Mar 04 '18 at 13:06
  • @halfer I apologize for my way of asking help, but this was a kinda high priority issue for me... hence I was desperate to seek help from others. – rohit kumar Mar 05 '18 at 05:20
  • can't do so..... it says you are banned from this..... i am sorry – rohit kumar Mar 12 '18 at 09:46
  • Ah, I see. There are various instructions on the _Meta_ site to explain how to get out of an answer ban, [see here](https://meta.stackoverflow.com/search?q=answer+ban). It means that some of your answers (potentially including deleted ones) were not well received, and a block was automatically applied by the system. I believe you can try to tidy up recently deleted answers and then undelete them to try to attract upvotes on them, or improve existing non-deleted ones. – halfer Mar 12 '18 at 10:12
  • I've posted your solution anyway, thanks for providing it! – halfer Mar 12 '18 at 10:15

1 Answers1

1

(Posted on behalf of the question author, from a comment).

This was solved as follows:

  1. enable usb debugging.

  2. download latest usb driver for phone.

  3. setx PATH "%PATH%;C:\Program Files\android-sdk\platform-tools" (see here)

  4. execute adb. exe from C:\Users[youruser]\AppData\Local\Android\android-studio\sdk\platform-tools

  5. run adb devices in cmd to see list of connected devices

  6. Run the following in a command prompt:

    $ adb -s <device name> reverse tcp:8081 tcp:8081
    

    To find the device name, run the following adb command:

    $ adb devices
    
halfer
  • 19,824
  • 17
  • 99
  • 186