globocom / react-native-ua

React Native module for Urban Airship
MIT License
37 stars 33 forks source link

Methods return rejected promise #48

Closed jdlee23 closed 7 years ago

jdlee23 commented 7 years ago

Error message:

{ [TypeError: undefined is not an object (evaluating 'bridge.areNotificationsEnabled')]
line: 104755,
column: 7,
sourceURL: 'http://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false' }

Seems to work fine on iOS however for android I updated my build tools version along with the sdk because it was asking for 24. Afterwards, I get this error whenever I try to use a method on android. Any clue why?

heres my build.gradle

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "com.versussystems.authenticator"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    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"
        }
    }
    // 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-ua')
    compile project(':react-native-image-picker')
    compile project(':react-native-android-location-services-dialog-box')
    compile project(':react-native-svg')
    compile project(':react-native-camera')
    compile project(':react-native-device-info')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:24.2.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
}

edit: this for the emulator, on the device it crashes on startup

jdlee23 commented 7 years ago

I added this to my build.gradle

    compile 'com.google.android.gms:play-services-gcm:+'
    compile 'com.google.android.gms:play-services-location:+'

and it doesn't crash my application anymore also i don't think it works on the emulator. so that was why i was getting errors before

now i'm having issues with the methjd get_channel_id as an undefined function

jdlee23 commented 7 years ago

Looks like get_channel_id isn't in my react native package. Is the NPM version updated to match the repo?

jdlee23 commented 7 years ago

will make new issue to update npm package