Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7190

Android app crashes on release build but works in debug build - React-Native

$
0
0

i know this is a common problem but the error i am seeing is different here's the error

06-13 15:37:51.081  1690  3926 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.lawyr/.MainActivity bnds=[849,682][1056,960] (has extras)} from uid 10020 on display 006-13 15:37:51.137  1690  1782 I ActivityManager: Start proc 13071:com.lawyr/u0a88 for activity com.lawyr/.MainActivity06-13 15:37:51.285 13071 13071 D SoLoader: adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.lawyr-1/lib/x86 flags = 0]06-13 15:37:51.290 13071 13071 D SoLoader: adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/data/com.lawyr/lib-main flags = 1]06-13 15:37:51.293 13071 13071 D SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.lawyr-1/lib/x86 flags = 0]06-13 15:37:51.294 13071 13071 D SoLoader: Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/data/com.lawyr/lib-main flags = 1]06-13 15:37:51.297 13071 13071 V fb-UnpackingSoSource: locked dso store /data/user/0/com.lawyr/lib-main06-13 15:37:51.299 13071 13071 I fb-UnpackingSoSource: dso store is up-to-date: /data/user/0/com.lawyr/lib-main06-13 15:37:51.299 13071 13071 V fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.lawyr/lib-main06-13 15:37:51.337 13071 13071 E EmbeddedLoader:    at com.lawyr.MainApplication.onCreate(MainApplication.java:86)06-13 15:37:51.338 13071 13071 E AndroidRuntime: Process: com.lawyr, PID: 1307106-13 15:37:51.338 13071 13071 E AndroidRuntime:    at com.lawyr.MainApplication.onCreate(MainApplication.java:86)06-13 15:37:51.340  1690  2045 W ActivityManager:   Force finishing activity com.lawyr/.MainActivity06-13 15:37:51.850  1690  1703 W ActivityManager: Activity pause timeout for ActivityRecord{30dba1e u0 com.lawyr/.MainActivity t51 f}06-13 15:37:51.853  1690  1703 I WindowManager: Failed to capture screenshot of Token{cc192ff ActivityRecord{30dba1e u0 com.lawyr/.MainActivity t51 f}} appWin=Window{ad21564 u0 Starting com.lawyr} drawState=4

MainActivity.java

package com.lawyr;import com.facebook.react.ReactActivity;import com.facebook.react.ReactActivityDelegate;import com.facebook.react.ReactRootView;import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;public class MainActivity extends ReactActivity {    /**     * Returns the name of the main component registered from JavaScript.     * This is used to schedule rendering of the component.     */    @Override    protected String getMainComponentName() {        return "main";    }    @Override    protected ReactActivityDelegate createReactActivityDelegate() {        return new ReactActivityDelegate(this, getMainComponentName()) {            @Override            protected ReactRootView createRootView() {                return new RNGestureHandlerEnabledRootView(MainActivity.this);            }        };    }}

MainApplication.java

package com.lawyr;import android.app.Application;import android.content.Context;import android.net.Uri;import com.facebook.react.PackageList;import com.facebook.react.ReactApplication;import com.oblador.vectoricons.VectorIconsPackage;import com.facebook.react.ReactNativeHost;import com.facebook.react.ReactPackage;import com.facebook.react.shell.MainReactPackage;import com.facebook.soloader.SoLoader;import com.lawyr.generated.BasePackageList;import org.unimodules.adapters.react.ReactAdapterPackage;import org.unimodules.adapters.react.ModuleRegistryAdapter;import org.unimodules.adapters.react.ReactModuleRegistryProvider;import org.unimodules.core.interfaces.Package;import org.unimodules.core.interfaces.SingletonModule;import expo.modules.constants.ConstantsPackage;import expo.modules.permissions.PermissionsPackage;import expo.modules.filesystem.FileSystemPackage;import expo.modules.updates.UpdatesController;import java.lang.reflect.InvocationTargetException;import java.util.Arrays;import java.util.List;import javax.annotation.Nullable;public class MainApplication extends Application implements ReactApplication {  private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(    new BasePackageList().getPackageList(),    null  );  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {    @Override    public boolean getUseDeveloperSupport() {      return BuildConfig.DEBUG;    }    @Override    protected List<ReactPackage> getPackages() {      List<ReactPackage> packages = new PackageList(this).getPackages();      packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));      return packages;    }    @Override    protected String getJSMainModuleName() {      return "index";    }    @Override    protected @Nullable String getJSBundleFile() {      if (BuildConfig.DEBUG) {        return super.getJSBundleFile();      } else {        return UpdatesController.getInstance().getLaunchAssetFile();      }    }    @Override    protected @Nullable String getBundleAssetName() {      if (BuildConfig.DEBUG) {        return super.getBundleAssetName();      } else {        return UpdatesController.getInstance().getBundleAssetName();      }    }  };  @Override  public ReactNativeHost getReactNativeHost() {    return mReactNativeHost;  }  @Override  public void onCreate() {    super.onCreate();    SoLoader.init(this, /* native exopackage */ false);    // initializeFlipper(this); // Remove this line if you don't want Flipper enabled    if (!BuildConfig.DEBUG) {      UpdatesController.initialize(this);    }  }  /**   * Loads Flipper in React Native templates.   *   * @param context   */  private static void initializeFlipper(Context context) {    if (BuildConfig.DEBUG) {      try {        /*         We use reflection here to pick up the class that initializes Flipper,        since Flipper library is not available in release mode        */        Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");        aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);      } catch (ClassNotFoundException e) {        e.printStackTrace();      } catch (NoSuchMethodException e) {        e.printStackTrace();      } catch (IllegalAccessException e) {        e.printStackTrace();      } catch (InvocationTargetException e) {        e.printStackTrace();      }    }  }}

here's s my packages.json

{"name": "Lawyr","version": "0.1.0","private": true,"devDependencies": {"@babel/core": "~7.9.0","babel-eslint": "^10.0.1","babel-jest": "~25.2.6","eslint": "^5.7.0","eslint-config-airbnb": "^17.1.0","eslint-plugin-import": "^2.14.0","eslint-plugin-jest": "^21.25.1","eslint-plugin-jsx-a11y": "^6.1.2","eslint-plugin-react": "^7.11.1","jest": "~25.2.6","jest-expo": "^37.0.0","react-native-debugger-open": "^0.3.17","react-native-scripts": "1.11.1","react-test-renderer": "16.2.0"  },"main": "node_modules/expo/AppEntry.js","scripts": {"start": "react-native start","android": "react-native run-android","ios": "react-native run-ios","test": "jest"  },"jest": {"preset": "jest-expo"  },"dependencies": {"@react-native-community/google-signin": "^4.0.3","@react-native-community/netinfo": "5.5.1","@react-native-community/viewpager": "^4.0.0","axios": "^0.18.0","date-fns": "^1.29.0","enzyme": "^3.7.0","enzyme-adapter-react-16": "^1.6.0","expo": "^37.0.0","expo-constants": "~9.0.0","expo-font": "~8.1.0","expo-linear-gradient": "~8.1.0","expo-permissions": "~8.1.0","expo-updates": "~0.1.0","lodash": "^4.17.10","prop-types": "^15.6.2","react": "~16.9.0","react-dom": "~16.9.0","react-native": "~0.62.2","react-native-app-intro-slider": "^0.2.4","react-native-chart-kit": "^5.4.0","react-native-credit-card-input": "^0.4.1","react-native-datepicker": "^1.7.2","react-native-fbsdk": "^2.0.0","react-native-gesture-handler": "~1.6.0","react-native-hr-component": "^1.0.6","react-native-mock-render": "^0.1.2","react-native-modal-datetime-picker": "^6.0.0","react-native-paystack": "^3.4.0","react-native-picker-select": "^5.1.0","react-native-reanimated": "~1.7.0","react-native-screens": "~2.2.0","react-native-scrollable-tab-view": "^1.0.0","react-native-svg": "11.0.1","react-native-swipe-list-view": "^3.1.1","react-native-tab-view": "0.0.77","react-native-unimodules": "~0.9.0","react-native-vector-icons": "^6.6.0","react-native-web": "~0.11.7","react-navigation": "^2.9.3","react-redux": "^5.0.7","redux": "^4.0.0","redux-devtools-extension": "^2.13.5","redux-logger": "^3.0.6","redux-mock-store": "^1.5.3","redux-persist": "^5.10.0","redux-thunk": "^2.2.0","styled-components": "^3.2.3","whatwg-fetch": "^2.0.4"  }}

i did build release and the app crashes on launch i tried build it with debug and run without error.

the app was initially in expo but did expo eject to get the ios and android folders


Viewing all articles
Browse latest Browse all 7190

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>