question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Release APK fails immediately on launch (Version 0.54)

See original GitHub issue

I have a web view app that is very straightforward. The iOS version is running perfectly. The android version runs perfectly in debug mode using the package server. However, the release version of the apk crashes immediately when launched.

The errors I am getting from logcat are:

03-12 22:12:07.665 16051-16068/? E/AndroidRuntime: FATAL EXCEPTION: Thread-2
                                                   Process: com.gtcworx, PID: 16051
                                                   java.lang.RuntimeException: Unable to load script from assets 'index.android.bundle'. Make sure your bundle is packaged correctly or you're running a packager server.
                                                       at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
                                                       at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:216)
                                                       at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:33)
                                                       at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:234)
                                                       at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1113)
                                                       at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:113)
                                                       at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:920)
                                                       at java.lang.Thread.run(Thread.java:764)
03-12 22:12:07.789 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.videos-fSpP8T16jLfLPEk3Hl3pmw==/base.apk
03-12 22:12:07.790 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.videos-fSpP8T16jLfLPEk3Hl3pmw==/base.apk
03-12 22:12:07.790 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.videos-fSpP8T16jLfLPEk3Hl3pmw==/base.apk
03-12 22:12:07.794 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.apps.docs.editors.slides-9EEF5YDNu3OKNBNwayfu9g==/base.apk
03-12 22:12:07.794 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.apps.docs.editors.slides-9EEF5YDNu3OKNBNwayfu9g==/base.apk
03-12 22:12:07.794 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.apps.docs.editors.slides-9EEF5YDNu3OKNBNwayfu9g==/base.apk
03-12 22:12:07.795 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.contacts-2KRJls5awi4KQQ6cjkUQQA==/base.apk
03-12 22:12:07.795 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.contacts-2KRJls5awi4KQQ6cjkUQQA==/base.apk
03-12 22:12:07.797 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.dialer-1BN26SkEVNcra4NPGyK-nA==/base.apk
03-12 22:12:07.797 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.dialer-1BN26SkEVNcra4NPGyK-nA==/base.apk
03-12 22:12:07.797 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.google.android.dialer-1BN26SkEVNcra4NPGyK-nA==/base.apk
03-12 22:12:07.798 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.gtcworx-XlyWECmWk-Pjfh6CE3jV4Q==/base.apk
03-12 22:12:07.799 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.gtcworx-XlyWECmWk-Pjfh6CE3jV4Q==/base.apk
03-12 22:12:07.799 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.gtcworx-XlyWECmWk-Pjfh6CE3jV4Q==/base.apk
03-12 22:12:07.799 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.gtcworx-XlyWECmWk-Pjfh6CE3jV4Q==/base.apk
03-12 22:12:07.800 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.gtcworx-XlyWECmWk-Pjfh6CE3jV4Q==/base.apk
03-12 22:12:07.805 2055-2075/? E/ResourcesManager: failed to add asset path /data/app/com.gtcworx-XlyWECmWk-Pjfh6CE3jV4Q==/base.apk

since this does not use the package server, I figured the problem is that the bundle is packaged incorrectly. However, I am not sure that I can do to fix the way the package is bundled.

I did some searches and noticed that this problem is caused the View.propTypes references. I followed the steps to see if there were any such references in my modules and there are not. There are only comments referring to the issue and explaining the patches put into place.

I also found an article that suggested I check the name of the app in the index.js file and compare that with the name in the MainActivity. I checked those and they are identical. I also checked my package.json for the same name.

I have also done several cleans of the project using Gradle.

Thanks for any help that can be provided.

Environment

Environment:
  OS: macOS High Sierra 10.13.3
  Node: 8.8.1
  Yarn: 1.3.2
  npm: 5.4.2
  Watchman: 4.9.0
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed)
  react: ^16.2.0 => 16.2.0
  react-native: ^0.54.2 => 0.54.2

Expected Behavior

I expected the app to launch and show the website in the webView.

I am unable to reproduce the error in snack, but here is the link that shows how it should work: https://snack.expo.io/r1JzDYSFG

Actual Behavior

dialog box shows up saying “app has stopped” and ask to open again.

Steps to Reproduce

  1. Create a web view app
  2. Build it using the versions of the libs I have above
  3. Generate a signed release apk
  4. Install release apk onto device
  5. Run the app

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:15
  • Comments:68 (2 by maintainers)

github_iconTop GitHub Comments

128reactions
bhardman1986commented, Sep 30, 2018

The issue for me was fixed by:

• Within your projects build.gradle change the buildScripts dependencies classpath to ‘com.android.tools.build:gradle:3.1.4’ // I wasn’t able to get v3.2.0 to work, so I had to downgrade to 3.1.4. This might work with lower versions too, but I haven’t tested it. • Placing android.enableAapt2=false within the gradle.properties. • Within the terminal on the Project folder enter cd android && ./gradlew clean assembleRelease • Within the terminal on the Project folder enter react-native run-android --variant=release to verify that the app-release.apk works properly.

I’ve tried with and without ‘org.gradle.configurationOnDemand=false’ with no difference to being able to build. I’m also running react-native: 0.56.1

Hope this helps someone.

36reactions
jsaraivacommented, Nov 8, 2018

Apparently, Gradle 3.2.0 changed the location to which it generates asset bundles. RN expects its JS asset bundle to be in a specific path, which is the path used by Gradle 3.1.4. Because G3.2.0 puts them in a different spot, RN cannot find the JS asset bundle, and thus the files with the Javascript to run. Ergo, the crash in release mode.

In debug mode, the JS files are provided by the Metro daemon, and there is no JS asset bundle to be loaded. That’s why this error only manifests itself in release mode.

This is why lots of people suggest fixes that involve creating the asset bundle manually (via CLI), copying it manually to a specific folder, and then running the apk generator. But, let’s face it, it’s way easier to just downgrade Gradle to a version that works the way RN expects.

Now, why the RN devs didn’t update the native source code to get the bundle from its new location, that is a mystery that I haven’t figured out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Native assembleRelease fails for task - Stack Overflow
This gonna build your app. After build is done, go to see your application(apk). android\app\build\outputs\apk\release.
Read more >
VMware Workspace ONE UEM™ Powered by AirWatch 2111 ...
VMware Workspace ONE UEM™ Powered by AirWatch Release Notes provide information on the new features and improvements in each release.
Read more >
By Jack Palevich - Terminal Emulator for Android 1.0.70
Version : 1.0.70 (71) Languages: 23. Package: jackpal.androidterm. Downloads: 659,180. 0.54 MB (564,672 bytes). Min: Android 1.6 (Donut, API 4)
Read more >
GameMaker Release Notes
Version 2022.11.1.56 Windows macOS. Tue, 13 Dec 2022 12:47:07 Z. November's 2022.11 release brings the ability for you to pick which bits of...
Read more >
Getting Meson
With this, you will have python and pip in PATH , and you can install Meson with pip. You will also be able...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found