Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android release crashes upon start. Stuck for a few days. Please help. (adb logcat included) #12013

Closed
booboothefool opened this issue Jan 21, 2017 · 2 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@booboothefool
Copy link

booboothefool commented Jan 21, 2017

Runs great in dev mode, release crashes upon start.

    "react": "15.3.2",
    "react-dom": "15.3.2",
    "react-native": "0.37.0",

adb logcat

01-21 05:00:50.625 13176 13176 W ResourcesManager: getTopLevelResources: /data/app/com.myclient-1/base.apk / 1.0 running in com.myclient rsrc of package com.myclient
01-21 05:00:50.625 13176 13176 W ResourcesManager: getTopLevelResources: /data/app/com.myclient-1/base.apk / 1.0 running in com.myclient rsrc of package com.myclient
01-21 05:00:50.655 13176 13176 D ReactNative: [CodePush] Loading JS bundle from "assets://index.android.bundle"
01-21 05:00:50.665 13176 13176 V fb-UnpackingSoSource: locked dso store /data/user/0/com.myclient/lib-main
01-21 05:00:50.665 13176 13176 I fb-UnpackingSoSource: dso store is up-to-date: /data/user/0/com.myclient/lib-main
01-21 05:00:50.665 13176 13176 V fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.myclient/lib-main
01-21 05:00:50.695 13176 13176 I art     : Thread[1,tid=13176,Native,Thread*=0xf4aa4500,peer=0x751586f0,"main"] recursive attempt to load library "/data/app/com.myclient-1/lib/arm/libfb.so"
01-21 05:00:50.695 13176 13176 D Activity: performCreate Call Injection manager
01-21 05:00:50.705 13176 13176 I InjectionManager: dispatchOnViewCreated > Target : com.myclient.MainActivity isFragment :false
01-21 05:00:50.705 13176 13176 D SecWifiDisplayUtil: Metadata value : SecSettings2
01-21 05:00:50.705 13176 13176 D ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{aed1e72 I.E...... R.....ID 0,0-0,0}
01-21 05:00:50.705 13176 13199 D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
01-21 05:00:50.715 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTRenderableViewManager
01-21 05:00:50.715 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupShadowNode
01-21 05:00:50.715 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeShadowNode
01-21 05:00:50.715 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextShadowNode
01-21 05:00:50.715 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewManager
01-21 05:00:50.715 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewShadowNode
01-21 05:00:50.725  3493  4537 D InputDispatcher: Focus entered window: 13176
01-21 05:00:50.725 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDialogPickerManager
01-21 05:00:50.725 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
01-21 05:00:50.725 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
01-21 05:00:50.725 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager
01-21 05:00:50.725 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
01-21 05:00:50.725 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
01-21 05:00:50.735 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
01-21 05:00:50.735 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
01-21 05:00:50.735 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
01-21 05:00:50.735 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
01-21 05:00:50.735 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
01-21 05:00:50.745 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
01-21 05:00:50.745 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
01-21 05:00:50.745 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
01-21 05:00:50.745 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
01-21 05:00:50.745 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
01-21 05:00:50.745 13176 13199 D libEGL  : loaded /vendor/lib/egl/libGLES_mali.so
01-21 05:00:50.745 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
01-21 05:00:50.745 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
01-21 05:00:50.745 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
01-21 05:00:50.745 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
01-21 05:00:50.755 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
01-21 05:00:50.755 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
01-21 05:00:50.755 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.toolbar.ReactToolbarManager
01-21 05:00:50.755 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
01-21 05:00:50.765 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager
01-21 05:00:50.765 13176 13199 D libEGL  : eglInitialize EGLDisplay = 0xeeb7f7c4
01-21 05:00:50.765 13176 13199 I OpenGLRenderer: Initialized EGL, version 1.4
01-21 05:00:50.765 13176 13199 D         : ro.exynos.dss isEnabled: 0
01-21 05:00:50.765 13176 13199 D mali_winsys: new_window_surface returns 0x3000,  [1440x2560]-format:1
01-21 05:00:50.765 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
01-21 05:00:50.765 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.webview.ReactWebViewManager
01-21 05:00:50.765 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.recyclerview.RecyclerViewBackedScrollViewManager
01-21 05:00:50.775 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
01-21 05:00:50.775 13176 13176 D ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 96 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1
01-21 05:00:50.775 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.sbugert.rnadmob.RNAdMobBannerViewManager
01-21 05:00:50.775 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.github.xinthink.rnmk.MKTouchableManager
01-21 05:00:50.775 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.github.xinthink.rnmk.MKSpinnerManager
01-21 05:00:50.775 13176 13196 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.github.xinthink.rnmk.TickViewManager
01-21 05:00:50.785 13176 13176 W DisplayListCanvas: DisplayListCanvas is started on unbinded RenderNode (without mOwningView)
01-21 05:00:50.795 13176 13176 I Timeline: Timeline: Activity_idle id: android.os.BinderProxy@670c73c time:292438814
01-21 05:00:50.815 13176 13218 W InstanceID/Rpc: Found 10016
01-21 05:00:50.895 13176 13229 W ResourcesManager: getTopLevelResources: /data/app/com.google.android.gms-2/base.apk / 1.0 running in com.myclient rsrc of package com.google.android.gms
01-21 05:00:50.905 13176 13229 D ResourcesManager: For user 0 new overlays fetched Null
01-21 05:00:51.225 13176 13224 W ResourceType: No package identifier when getting value for resource number 0x00000000
01-21 05:00:51.555 13176 13225 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
01-21 05:00:51.555 13176 13225 E AndroidRuntime: Process: com.myclient, PID: 13176
01-21 05:00:51.555 13176 13225 E AndroidRuntime: java.lang.NullPointerException: url == null
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at okhttp3.Request$Builder.url(Request.java:131)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at com.facebook.react.modules.websocket.WebSocketModule.connect(WebSocketModule.java:88)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:739)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:95)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:158)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
01-21 05:00:51.555 13176 13225 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:818)
01-21 05:00:51.555 13176 13224 E ReactNativeJS: A remote enpdoint is required for a network layer
01-21 05:00:51.555  3493  6026 D InputDispatcher: Focus left window: 13176
01-21 05:00:51.555 13176 13224 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
01-21 05:00:52.125 13176 13224 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag)
01-21 05:00:52.125 13176 13176 D ViewRootImpl: #3 mView = null
01-21 05:00:54.765 13176 13225 I Process : Sending signal. PID: 13176 SIG: 9
01-21 05:00:54.795  3493  4138 W InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 13176 uid 10366
01-21 05:00:54.855  3493  4412 I ActivityManager: Process com.myclient (pid 13176)(adj 9) has died(84,858)

build.gradle

apply plugin: "com.android.application"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

import com.android.build.OutputFile

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.myclient"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        manifestPlaceholders = [manifestApplicationId: "${applicationId}",
                                onesignal_app_id: "xxxx8b7f-xx6c-xx1f-xx8b-xxxxx11e0364",
                                onesignal_google_project_number: "xxxxxxxx8932"]
    }
    signingConfigs {
      release {
        storeFile file(MYCLIENT_RELEASE_STORE_FILE)
        storePassword MYCLIENT_RELEASE_STORE_PASSWORD
        keyAlias MYCLIENT_RELEASE_KEY_ALIAS
        keyPassword MYCLIENT_RELEASE_KEY_PASSWORD
      }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-hockeyapp')
    compile project(':react-native-code-push')
    compile project(':react-native-image-crop-picker')
    compile project(':react-native-vector-icons')
    compile project(':react-native-material-kit')
    compile project(':react-native-image-picker')
    compile project(':react-native-config')
    compile project(':react-native-admob')
    compile project(':react-native-onesignal')
    compile project(':react-native-push-notification')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

I have tried:

#Clean everything possible

# watchman
watchman watch-del-all

# ios
rm -rf ios/build/ModuleCache/*

# android
rm -rf android/build
rm -rf android/app/build
rm -rf $HOME/.gradle/caches/

# javascript
rm -rf node_modules/
yarn cache clean

# Fresh install
yarn

# clear react temp files (keep this last clean step)
rm -rf $TMPDIR/react-*

react-native link

then:

    "clean-android-prod": "cd android && ./gradlew clean && rm -rf build && cd app && rm -rf build && cd ../..",
    "build-android-prod": "export ENVFILE=.env.prod && cd android && ./gradlew assembleRelease --stacktrace --info && cd ..",
    "install-android-prod": "cd android && ./gradlew installRelease --stacktrace --info && cd ..",
@booboothefool
Copy link
Author

booboothefool commented Jan 22, 2017

Okay, so I ended up wiping the entire project and recloning it from GitHub.

When I tried to start the app again in dev mode via react-native run-android, I started getting an error like the release:

url == null

I then realized the reason my app wasn't starting was because I didn't add the .env files back (because I just wiped it, cloned it, and I'm not committing my .env files).

This led me to conclude that in my release build, my .env wasn't being set properly. I'm actually running a command like this:

    "clean-android-prod": "cd android && ./gradlew clean && rm -rf build && cd app && rm -rf build && cd ../..",
    "build-android-prod": "export ENVFILE=.env.prod && cd android && ./gradlew assembleRelease --stacktrace --info && cd ..",
    "install-android-prod": "cd android && ./gradlew installRelease --stacktrace --info && cd ..",
    "full-android-prod": "npm run clean-android-prod && npm run build-android-prod && npm run install-android-prod",

I changed it to this:

    "clean-android-prod": "cd android && ./gradlew clean && rm -rf build && cd app && rm -rf build && cd ../..",
    "build-android-prod": "export ENVFILE=.env.prod && cd android && ./gradlew assembleRelease --stacktrace --info && cd ..",
    "install-android-prod": "export ENVFILE=.env.prod && cd android && ./gradlew installRelease --stacktrace --info && cd ..",
    "full-android-prod": "export ENVFILE=.env.prod && npm run clean-android-prod && npm run build-android-prod && npm run install-android-prod",

It's not clear to me where or where I don't need export ENVFILE=.env.prod &&, so I just put it everywhere...

I also added this to my ProGuard:

-keep class com.myclient.BuildConfig { *; }

because https://github.com/luggit/react-native-config#problems-with-proguard.

Btw, I use Apollo GraphQL, and url == null seemed to come from

const networkInterface = createNetworkInterface({ uri: Config.GRAPHQL_URL });

(because my .env config wasn't getting to my release properly).

Crazy stuff.

@halfer
Copy link

halfer commented Jan 22, 2017

Pro tips for posting here and on Stack Overflow:

  • Post in one forum one at a time, rather than posting in several places at the same time;
  • Your Stack Overflow question did the right thing in acknowledging this cross-post, but not the other way around. So, if it had been solved there and not here, GitHub readers may have made a duplicate effort in resolving it;
  • Furthermore, on Stack Overflow, a link to another forum is not a self-contained question. Everything necessary to answer the question needs to be in the question itself (though cross-post declarations are still required, and live pasteboards such as SQL Fiddle and JS Fiddle are welcome additionally).

Note also that succinct and description titles are good in both places. "Please help" and "I'm stuck" is begging, which can sometimes rub volunteers up the wrong way.

Hope that feedback helps!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants