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) E/onesignal: Unable to initialize the OneSignal SDK because activity is null true or oneSignalInitDonefalse #516

Closed
aspidvip opened this issue May 19, 2018 · 30 comments · Fixed by #572

Comments

@aspidvip
Copy link

aspidvip commented May 19, 2018

Hello!
"react-native": "0.55.3",
"react-native-onesignal": "^3.2.3",

app.js

componentWillMount() {
    OneSignal.init('bddacd3f-7812-4a29-b038-.................');
    OneSignal.addEventListener('received', this.onReceived);
    OneSignal.addEventListener('opened', this.onOpened);
    OneSignal.addEventListener('ids', this.onIds);
}



onReceived(notification) {
        console.log("Notification received: ", notification);
    }

    onOpened(openResult) {
      console.log('Message: ', openResult.notification.payload.body);
      console.log('Data: ', openResult.notification.payload.additionalData);
      console.log('isActive: ', openResult.notification.isAppInFocus);
      console.log('openResult: ', openResult);
    }



    onIds(device) {
		console.log('Device info: ', device);
   }
  1. work on iOS

  2. not work on Android

@aspidvip
Copy link
Author

1

@Nightsd01
Copy link
Contributor

@aspidvip can you please provide some more details? Does this error throw an exception and crash, or does it just not work (no player id, unable to receive push notifications, etc)? What are the symptoms?

@urbancvek
Copy link

urbancvek commented May 19, 2018

I had this problem too. I think it's because of react-native-navigation. It launches another activity just after the application launches. If you call OneSignal.init() in the meantime it says that activity is null - the error that you have.

If you wait for a few seconds before calling OneSignal.init() it works but then you get another error. The one with FirebaseApp not initialized. Issue #515. Hoping for a fix or workaround for this too...

@urbancvek
Copy link

I solved by just using react-native-onesignal:3.1.4. It initializes using:

defaultConfig {
        applicationId "APP_ID"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }

        manifestPlaceholders = [onesignal_app_id: "YOUR_ONESIGNAL_ID",
                                onesignal_google_project_number: "REMOTE"]
    }

and that's it. Way simpler than doing it from JS side if you're using react-native-navigation.

@aspidvip
Copy link
Author

no player id, unable to receive push notifications!

@Nightsd01
Copy link
Contributor

@urbancvek That same initialization technique (using AppDelegate for iOS and gradle for Android) also works in 3.2.3

@aspidvip That is a very broad issue, it could be anything. This likely is an issue with react-native-navigation and the timing of your OneSignal initialization

@aspidvip
Copy link
Author

I did

componentDidMount(){
    setTimeout(()=>{
      OneSignal.init('bddacd3f-7812-4a29-b038-ebf844c9826d');
    },5000);
}

E/OneSignal: The included Android Support Library is to old or incomplete. Please update to the 26.0.0 revision or newer.
D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
I/zygote: Rejecting re-init on previously-failed class java.lang.Class<com.onesignal.OneSignalChromeTab$OneSignalCustomTabsServiceConnection>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/customtabs/CustomTabsServiceConnection;
I/zygote:     at void com.onesignal.OneSignalChromeTab.setup(android.content.Context, java.lang.String, java.lang.String, java.lang.String) (OneSignalChromeTab.java:46)
I/zygote:     at void com.onesignal.OneSignal$7.run() (OneSignal.java:1164)
I/zygote:     at void java.lang.Thread.run() (Thread.java:764)
I/zygote: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.customtabs.CustomTabsServiceConnection" on path: DexPathList[[zip file "/data/app/com.publikun-tQvVeGt0XjzJehSUmUpCQw==/base.apk"],nativeLibraryDirectories=[/data/app/com.publikun-tQvVeGt0XjzJehSUmUpCQw==/lib/x86, /data/app/com.publikun-tQvVeGt0XjzJehSUmUpCQw==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
I/zygote:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
I/zygote:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
I/zygote:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/zygote:     at void com.onesignal.OneSignalChromeTab.setup(android.content.Context, java.lang.String, java.lang.String, java.lang.String) (OneSignalChromeTab.java:46)
I/zygote:     at void com.onesignal.OneSignal$7.run() (OneSignal.java:1164)
I/zygote:     at void java.lang.Thread.run() (Thread.java:764)
I/zygote: Rejecting re-init on previously-failed class java.lang.Class<com.onesignal.OneSignalChromeTab$OneSignalCustomTabsServiceConnection>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/customtabs/CustomTabsServiceConnection;
I/zygote:     at void com.onesignal.OneSignalChromeTab.setup(android.content.Context, java.lang.String, java.lang.String, java.lang.String) (OneSignalChromeTab.java:46)
I/zygote:     at void com.onesignal.OneSignal$7.run() (OneSignal.java:1164)
I/zygote:     at void java.lang.Thread.run() (Thread.java:764)
I/zygote: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.customtabs.CustomTabsServiceConnection" on path: DexPathList[[zip file "/data/app/com.publikun-tQvVeGt0XjzJehSUmUpCQw==/base.apk"],nativeLibraryDirectories=[/data/app/com.publikun-tQvVeGt0XjzJehSUmUpCQw==/lib/x86, /data/app/com.publikun-tQvVeGt0XjzJehSUmUpCQw==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
I/zygote:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
I/zygote:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
I/zygote:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/zygote:     at void com.onesignal.OneSignalChromeTab.setup(android.content.Context, java.lang.String, java.lang.String, java.lang.String) (OneSignalChromeTab.java:46)
I/zygote:     at void com.onesignal.OneSignal$7.run() (OneSignal.java:1164)
I/zygote:     at void java.lang.Thread.run() (Thread.java:764)
I/zygote: Rejecting re-init on previously-failed class java.lang.Class<com.onesignal.OneSignalChromeTab$OneSignalCustomTabsServiceConnection>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/customtabs/CustomTabsServiceConnection;
I/zygote:     at void com.onesignal.OneSignalChromeTab.setup(android.content.Context, java.lang.String, java.lang.String, java.lang.String) (OneSignalChromeTab.java:46)
I/zygote:     at void com.onesignal.OneSignal$7.run() (OneSignal.java:1164)
I/zygote:     at void java.lang.Thread.run() (Thread.java:764)
I/zygote: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.customtabs.CustomTabsServiceConnection" on path: DexPathList[[zip file "/data/app/com.publikun-tQvVeGt0XjzJehSUmUpCQw==/base.apk"],nativeLibraryDirectories=[/data/app/com.publikun-tQvVeGt0XjzJehSUmUpCQw==/lib/x86, /data/app/com.publikun-tQvVeGt0XjzJehSUmUpCQw==/base.apk!/lib/x86, /system/lib, /vendor/lib]]
I/zygote:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:93)
I/zygote:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
I/zygote:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
I/zygote:     at void com.onesignal.OneSignalChromeTab.setup(android.content.Context, java.lang.String, java.lang.String, java.lang.String) (OneSignalChromeTab.java:46)
I/zygote:     at void com.onesignal.OneSignal$7.run() (OneSignal.java:1164)
I/zygote:     at void java.lang.Thread.run() (Thread.java:764)

@aspidvip
Copy link
Author

1

but no no player id, unable to receive push notifications!

@Nightsd01
Copy link
Contributor

Nightsd01 commented May 20, 2018

@aspidvip can you post your build.gradle? This would be a dependency issue for sure.

Also, you might try going into the react-native-onesignal/build.gradle file and update the OneSignal android SDK to 3.9.1

@aspidvip
Copy link
Author

aspidvip commented May 20, 2018

plugins {
        id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'


apply plugin: "com.android.application"
import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.vectoricons = [
        iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf', 'MaterialCommunityIcons.ttf', 'Ionicons.ttf' ] // Name of the font files you want to copy
]

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"





apply plugin: 'com.android.application'


project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = true

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"

    defaultConfig {
        applicationId "com.nameproject"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true 
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        /*manifestPlaceholders = [onesignal_app_id: "bddacd3f-7812-4a29-b038-ebf844c9826d",
                                onesignal_google_project_number: "712648705913"]*/
        manifestPlaceholders = [onesignal_app_id: "bddacd3f-7812-4a29-b038-ebf844c9826d",
                                onesignal_google_project_number: "712648705914"]
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk true  // 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-onesignal')
    compile project(':react-native-contacts')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile project(':react-native-navigation')
    compile project(':react-native-vector-icons')
    compile project(':react-native-fetch-blob')
    compile project(':react-native-photo-view')
    compile project(':react-native-i18n')
    compile project(':react-native-sqlite-storage')
    compile project(':react-native-linear-gradient')
    compile project(':react-native-image-crop-picker')
    compile project(':react-native-sound')
    compile project(':react-native-open-settings')

}

// 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'
}

@Nightsd01
Copy link
Contributor

Nightsd01 commented May 21, 2018

@aspidvip This means that the Android API level in react-native-onesignal/build.gradle and in your app/build.gradle likely don't match. I would suggest changing you app's API level to be:

    compileSdkVersion 23
    buildToolsVersion "23.0.1"

What matters most is that they match. You could also just go into react-native-onesignal/build.gradle and change it to be what you want.

@hamadasamir85
Copy link

matching the build.gradle files did not fix it

@Nightsd01
Copy link
Contributor

@hamadasamir85 I have no idea what your environment looks like, what dependencies you are using, and so on. So far aspidvip is the only person to post their build.gradle and other details. This is a broad issue and can have many potential causes. Please post some of the same details I've asked aspidvip.

@aspidvip Please let me know if matching the versions works/doesn't work, and also let me know what Android API levels you tried/didn't try.

And frankly, it would really help if you could send a demo project that reproduces this issue.

@cesarve77
Copy link

cesarve77 commented May 23, 2018

Same Issue:

On a fresh react native project

package.json

  "name": "myapp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.3.1",
    "react-native": "0.55.4",
    "react-native-onesignal": "^3.2.4"
  },
  "devDependencies": {
    "babel-jest": "22.4.4",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.4.4",
    "react-test-renderer": "16.3.1"
  },
  "jest": {
    "preset": "react-native"
  }
}


logcat

05-23 23:08:46.555 12785-12785/? E/Zygote: v2
05-23 23:08:46.555 12785-12785/? I/libpersona: KNOX_SDCARD checking this for 10304
    KNOX_SDCARD not a persona
05-23 23:08:46.557 12785-12785/? E/Zygote: accessInfo : 0
05-23 23:08:46.558 12785-12785/? W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2],  Con:u:r:zygote:s0 SPD:SEPF_SECMOBILE_7.0_0006 RAM:SEPF_SECMOBILE_7.0_0009, [-1 -1 -9 -1 0 1]
05-23 23:08:46.561 12785-12785/? I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=app.myapp 
05-23 23:08:46.569 12785-12785/? I/art: Late-enabling -Xcheck:jni
05-23 23:08:46.623 12785-12785/? D/TimaKeyStoreProvider: TimaSignature is unavailable
05-23 23:08:46.624 12785-12785/? D/ActivityThread: Added TimaKeyStore provider
05-23 23:08:46.735 12785-12785/app.myapp D/ContextRelationMgrBrdg: loadKlass() : caller=com.samsung.android.bridge.multiscreen.common.ContextRelationManagerBridge.<clinit>:28 android.app.LoadedApk.makeApplication:840 
05-23 23:08:46.748 12785-12785/app.myapp I/FirebaseInitProvider: FirebaseApp initialization unsuccessful
05-23 23:08:46.753 12785-12785/app.myapp V/fb-UnpackingSoSource: locked dso store /data/user/0/app.myapp/lib-main
05-23 23:08:46.756 12785-12785/app.myapp V/fb-UnpackingSoSource: deps mismatch on deps store: regenerating
    so store dirty: regenerating
05-23 23:08:46.817 12785-12785/app.myapp D/ApkSoSource: not allowing consideration of lib/armeabi-v7a/libfb.so: deferring to libdir
    not allowing consideration of lib/armeabi-v7a/libfolly_json.so: deferring to libdir
05-23 23:08:46.817 12785-12785/app.myapp D/ApkSoSource: not allowing consideration of lib/armeabi-v7a/libglog.so: deferring to libdir
    not allowing consideration of lib/armeabi-v7a/libglog_init.so: deferring to libdir
    not allowing consideration of lib/armeabi-v7a/libgnustl_shared.so: deferring to libdir
    not allowing consideration of lib/armeabi-v7a/libicu_common.so: deferring to libdir
05-23 23:08:46.818 12785-12785/app.myapp D/ApkSoSource: not allowing consideration of lib/armeabi-v7a/libimagepipeline.so: deferring to libdir
    not allowing consideration of lib/armeabi-v7a/libjsc.so: deferring to libdir
    not allowing consideration of lib/armeabi-v7a/libprivatedata.so: deferring to libdir
    not allowing consideration of lib/armeabi-v7a/libreactnativejni.so: deferring to libdir
    not allowing consideration of lib/armeabi-v7a/libyoga.so: deferring to libdir
05-23 23:08:46.818 12785-12785/app.myapp V/fb-UnpackingSoSource: regenerating DSO store com.facebook.soloader.ApkSoSource
05-23 23:08:46.819 12785-12785/app.myapp V/fb-UnpackingSoSource: starting syncer worker
05-23 23:08:46.836 12785-12785/app.myapp V/fb-UnpackingSoSource: releasing dso store lock for /data/user/0/app.myapp/lib-main (from syncer thread)
    not releasing dso store lock for /data/user/0/app.myapp/lib-main (syncer thread started)
05-23 23:08:46.914 12785-12785/app.myapp D/ReactNative: ReactInstanceManager.ctor()
05-23 23:08:46.936 12785-12785/app.myapp D/NetworkSecurityConfig: No Network Security Config specified, using platform default
05-23 23:08:46.988 12785-12785/app.myapp D/SensorManager: registerListener :: 0, K6DS3TR Acceleration Sensor, 66667, 0,  
05-23 23:08:47.027 12785-12785/app.myapp D/ReactNative: ReactInstanceManager.createReactContextInBackground()
    ReactInstanceManager.recreateReactContextInBackgroundInner()
05-23 23:08:47.066 12785-12851/app.myapp W/unknown:InspectorPackagerConnection: Couldn't connect to packager, will silently retry
05-23 23:08:47.117 12785-12785/app.myapp D/InputTransport: Input channel constructed: fd=65
05-23 23:08:47.118 12785-12785/app.myapp D/ViewRootImpl@5e04455[MainActivity]: setView = DecorView@40d2e6a[MainActivity] touchMode=true
05-23 23:08:47.125 12785-12785/app.myapp D/SensorManager: unregisterListener ::   
05-23 23:08:47.145 12785-12785/app.myapp D/SensorManager: registerListener :: 0, K6DS3TR Acceleration Sensor, 66667, 0,  
05-23 23:08:47.207 12785-12853/app.myapp I/OpenGLRenderer: Initialized EGL, version 1.4
05-23 23:08:47.207 12785-12853/app.myapp D/OpenGLRenderer: Swap behavior 1
05-23 23:08:47.229 12785-12853/app.myapp D/libGLESv1: STS_GLApi : DTS is not allowed for Package : app.myapp
05-23 23:08:47.232 12785-12853/app.myapp D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000,  [1440x2560]-format:1
05-23 23:08:47.255 12785-12785/app.myapp D/InputTransport: Input channel constructed: fd=71
05-23 23:08:47.255 12785-12785/app.myapp D/ViewRootImpl@5c120c2[PopupWindow:2eda90d]: setView = android.widget.PopupWindow$PopupDecorView{3423ed3 V.E...... ......I. 0,0-0,0} touchMode=true
05-23 23:08:47.256 12785-12785/app.myapp D/ViewRootImpl@5e04455[MainActivity]: MSG_RESIZED_REPORT: ci=Rect(0, 84 - 0, 0) vi=Rect(0, 84 - 0, 0) or=1
    MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
05-23 23:08:47.536 12785-12853/app.myapp D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_color_buffer_format*, EGLBoolean) returns 0x3000,  [1440x93]-format:1
05-23 23:08:47.550 12785-12785/app.myapp D/ViewRootImpl@5c120c2[PopupWindow:2eda90d]: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
05-23 23:08:48.641 12785-12785/app.myapp D/ViewRootImpl@5c120c2[PopupWindow:2eda90d]: dispatchDetachedFromWindow
05-23 23:08:48.670 12785-12785/app.myapp D/InputTransport: Input channel destroyed: fd=71
05-23 23:08:48.671 12785-12785/app.myapp D/ReactNative: ReactInstanceManager.onJSBundleLoadedFromServer()
05-23 23:08:48.672 12785-12785/app.myapp D/ReactNative: ReactInstanceManager.recreateReactContextInBackground()
05-23 23:08:48.673 12785-12785/app.myapp D/ReactNative: ReactInstanceManager.runCreateReactContextOnNewThread()
05-23 23:08:48.697 12785-13022/app.myapp I/art: Thread[25,tid=13022,Native,Thread*=0xdeac1600,peer=0x12cdf5e0,"Thread-5"] recursive attempt to load library "/data/app/app.myapp-2/lib/arm/libfb.so"
05-23 23:08:48.699 12785-13022/app.myapp D/ReactNative: ReactInstanceManager.createReactContext()
05-23 23:08:48.711 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupViewManager
05-23 23:08:48.713 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupShadowNode
05-23 23:08:48.717 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeViewManager
    Could not find generated setter for class com.facebook.react.views.art.ARTShapeShadowNode
05-23 23:08:48.720 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextViewManager
    Could not find generated setter for class com.facebook.react.views.art.ARTTextShadowNode
05-23 23:08:48.722 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.checkbox.ReactCheckBoxManager
05-23 23:08:48.729 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
05-23 23:08:48.740 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDialogPickerManager
05-23 23:08:48.744 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
05-23 23:08:48.749 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager
05-23 23:08:48.750 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
05-23 23:08:48.762 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
05-23 23:08:48.764 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
05-23 23:08:48.767 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
05-23 23:08:48.769 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
05-23 23:08:48.776 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
05-23 23:08:48.780 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
05-23 23:08:48.781 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
05-23 23:08:48.784 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
05-23 23:08:48.785 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.toolbar.ReactToolbarManager
05-23 23:08:48.791 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.webview.ReactWebViewManager
05-23 23:08:48.797 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
05-23 23:08:48.802 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewManager
05-23 23:08:48.803 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewShadowNode
05-23 23:08:48.804 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
05-23 23:08:48.805 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
05-23 23:08:48.807 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
05-23 23:08:48.814 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
05-23 23:08:48.817 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
05-23 23:08:48.818 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
05-23 23:08:48.820 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode
05-23 23:08:48.822 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
05-23 23:08:48.835 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
05-23 23:08:48.841 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
05-23 23:08:48.847 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
05-23 23:08:48.848 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
05-23 23:08:48.857 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager
05-23 23:08:48.862 12785-13022/app.myapp W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
    Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode
05-23 23:08:48.885 12785-13022/app.myapp D/ReactNative: Initializing React Xplat Bridge.
05-23 23:08:48.890 12785-13022/app.myapp D/ReactNative: Initializing React Xplat Bridge before initializeBridge
05-23 23:08:48.905 12785-13022/app.myapp D/ReactNative: Initializing React Xplat Bridge after initializeBridge
    CatalystInstanceImpl.runJSBundle()
05-23 23:08:48.906 12785-13054/app.myapp D/ReactNative: ReactInstanceManager.setupReactContext()
    CatalystInstanceImpl.initialize()
05-23 23:08:48.907 12785-13054/app.myapp D/ReactNative: ReactInstanceManager.attachRootViewToInstance()
05-23 23:08:48.907 12785-12785/app.myapp W/unknown:ReactNative: Packager connection already open, nooping.
05-23 23:08:49.512 12785-13054/app.myapp I/WebViewFactory: Loading com.android.chrome version 66.0.3359.158 (code 335915852)
05-23 23:08:49.675 12785-13054/app.myapp I/cr_LibraryLoader: Time to load native libraries: 13 ms (timestamps 3227-3240)
05-23 23:08:49.704 12785-13054/app.myapp I/chromium: [INFO:library_loader_hooks.cc(36)] Chromium logging enabled: level = 0, default verbosity = 0
05-23 23:08:49.705 12785-13054/app.myapp I/cr_LibraryLoader: Expected native library version number "66.0.3359.158", actual native library version number "66.0.3359.158"
05-23 23:08:49.994 12785-13053/app.myapp I/ReactNativeJS: Running application "myapp" with appParams: {"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF
05-23 23:08:50.096 12785-13054/app.myapp E/onesignal: Unable to initialize the OneSignal SDK because activity is null true or oneSignalInitDonefalse
05-23 23:09:03.299 12785-12798/app.myapp I/art: Background sticky concurrent mark sweep GC freed 22289(2MB) AllocSpace objects, 21(484KB) LOS objects, 15% free, 16MB/19MB, paused 904us total 119.769ms
05-23 23:09:21.462 12785-12785/app.myapp W/unknown:ReactNative: Packager connection already open, nooping.
05-23 23:09:21.618 12785-12785/app.myapp D/ViewRootImpl@5e04455[MainActivity]: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
05-23 23:09:21.856 12785-12785/app.myapp D/ViewRootImpl@5e04455[MainActivity]: MSG_RESIZED: ci=Rect(0, 84 - 0, 0) vi=Rect(0, 84 - 0, 0) or=1
05-23 23:09:21.894 12785-12785/app.myapp D/ViewRootImpl@5e04455[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1
05-23 23:09:21.904 12785-12785/app.myapp V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@95c25a2 nm : app.myapp ic=null
05-23 23:09:21.904 12785-12785/app.myapp I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
05-23 23:09:22.052 12785-12799/app.myapp D/InputTransport: Input channel constructed: fd=86
05-23 23:09:22.053 12785-12785/app.myapp V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@dcef9f0 nm : app.myapp ic=null
05-23 23:09:23.373 12785-12791/app.myapp I/art: Do partial code cache collection, code=30KB, data=30KB
05-23 23:09:23.374 12785-12791/app.myapp I/art: After code cache collection, code=30KB, data=30KB
    Increasing code cache capacity to 128KB
05-23 23:09:51.860 12785-12785/app.myapp V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@642c97f nm : app.myapp ic=null
05-23 23:09:51.861 12785-12785/app.myapp I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
05-23 23:09:51.871 12785-12785/app.myapp D/InputTransport: Input channel constructed: fd=83
    Input channel destroyed: fd=86
05-23 23:09:52.285 12785-12785/app.myapp D/SensorManager: unregisterListener ::   
05-23 23:09:52.726 12785-12785/app.myapp V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@dc47e9b nm : app.myapp ic=null
05-23 23:09:52.726 12785-12785/app.myapp I/InputMethodManager: [IMM] startInputInner - mService.startInputOrWindowGainedFocus
05-23 23:09:52.727 12785-12785/app.myapp D/InputTransport: Input channel destroyed: fd=83
05-23 23:09:52.807 12785-12785/app.myapp D/ViewRootImpl@5e04455[MainActivity]: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
05-23 23:09:52.888 12785-12785/app.myapp D/ViewRootImpl@5e04455[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0
05-23 23:13:47.153 12785-12798/app.myapp I/art: Background partial concurrent mark sweep GC freed 60244(2MB) AllocSpace objects, 9(3MB) LOS objects, 40% free, 12MB/21MB, paused 764us total 105.326ms

App.js

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View
} from 'react-native';
import OneSignal from 'react-native-onesignal';



const instructions = Platform.select({
  ios: 'Press Cmd+R to reload...,\n' +
    'Cmd+D or shake for dev menu',
  android: 'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

type Props = {};
export default class App extends Component<Props> {

    componentWillMount() {
        OneSignal.init("1c25f475-8b98-487d-8358-b3934f9bff64");
        OneSignal.addEventListener('received', this.onReceived);
        OneSignal.addEventListener('opened', this.onOpened);
        OneSignal.addEventListener('ids', this.onIds);
    }

    componentWillUnmount() {
        OneSignal.removeEventListener('received', this.onReceived);
        OneSignal.removeEventListener('opened', this.onOpened);
    }
    onIds=(deviceId)=> {
        console.log('Device info: ', deviceId);
    }
    onReceived(notification) {
        console.log("Notification received: ", notification);
    }

    onOpened(openResult) {
        console.log('Message: ', openResult.notification.payload.body);
        console.log('Data: ', openResult.notification.payload.additionalData);
        console.log('isActive: ', openResult.notification.isAppInFocus);
        console.log('openResult: ', openResult);
    }

  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit App.js
        </Text>
        <Text style={styles.instructions}>
          {instructions}
        </Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});


build.gradle

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "app.myapp"
        minSdkVersion 16
        targetSdkVersion 22
        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-onesignal')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.4.0"
    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'
}


By the way, I star a fresh project because was impossible to make it works on a existing project.

@Nightsd01
Copy link
Contributor

Nightsd01 commented Jun 9, 2018

To anyone who is also having this issue, it’s generally because of your app’s particular navigation stack. It can usually be fixed by using native initialization of the SDK as @urbancvek noted above. Please note that the SDK still supports native initialization (without using JS), you don’t have to go back to 3.1.4.

@Nightsd01
Copy link
Contributor

@cesarve77 @aspidvip Can either of you post your MainApplication.java?

@cesarve77
Copy link

cesarve77 commented Jun 12, 2018 via email

@cesarve77
Copy link

cesarve77 commented Jun 12, 2018 via email

@nicovak
Copy link

nicovak commented Jun 12, 2018

I tried to update and use the new instructions from the new readme. After some tries I
finally decided to switch back to "react-native-onesignal": "3.0.7", and everything works as before.

I tested 3.2.4, 3.2.3 ... and each time I had an issue. So I picked the version of one of my other project.

To resume I have the old implementation (native side) https://github.com/geektimecoil/react-native-onesignal/blob/732491fece1fa92946ca6dacf173af28a2b2e618/README.md and I call OneSignal.configure() in my javascript code, in my case it's in my mobx store once the user is logged to the app.

Issue on 3.2.3 : Unable to initialize the OneSignal SDK because activity is null true or oneSignalInitDonefalse
Issue on 3.2.4: You must initialize OneSignal before getting tags! Moving this tag operation to a pending queue.

@Nightsd01
Copy link
Contributor

@nicovak that likely means you’re using some dependency like react-native-navigation (as well as some others) that cause the initial activity passed to our SDK auto be null.

We’re working on a solution to this, in the mean time, downgrading to 3.0.7 is a good idea if you’re experiencing this particular issue.

@nicovak
Copy link

nicovak commented Jun 13, 2018

@Nightsd01 yes I am using react-native-router-flux which depends on react-navigation, after some search I finally get it working as expected.

I declared event listener in my App.js (included in index.js), these listeners update my store with desired values. Like that I can call functions easily when I need to. Before event listeners were declared in my store.
I put an example of code if someone has the same case.

I also had a little issue when the app was closed: I didn't receive the event opened. It was working only if the app was in background, with the code above everything works fine.

In my App.js

import OneSignal from "react-native-onesignal";

OneSignal.configure({});
OneSignal.addEventListener("opened", openResult => {
  AppStore.handleOpenIfAppClosed(openResult);
});
OneSignal.addEventListener("ids", device => {
  AppStore.handleUserId(device);
});

@observer
export default class App extends Component {

In my store

  handleOpenIfAppClosed(openResult) {
    this.pendingNotificationRequest = openResult;
  }

  handleUserId(device) {
    this.userId = device.userId;
  }

@Nightsd01
Copy link
Contributor

@nicovak How did you fix the main issue (activity is null)?

Also, with the opened issue...are you sure you are still using the latest version of react-native-onesignal? This is an issue that was fixed a while back.

@nicovak
Copy link

nicovak commented Jun 14, 2018

@Nightsd01 I am not using the last version (3.0.7), that's how I fix activity is null issue.
Like I said I had:

Issue on 3.2.3 : Unable to initialize the OneSignal SDK because activity is null true or oneSignalInitDonefalse

Issue on 3.2.4: You must initialize OneSignal before getting tags! Moving this tag operation to a pending queue.

@Nightsd01
Copy link
Contributor

@nicovak You can ignore that warning in 3.2.4. It means what it says: your app is somehow calling getTags() before initialization is done. It is just a warning however, because it will still work just fine.

If that's the only problem you are having in 3.2.4, I would heavily recommend updating back to 3.2.4 since it fixes many issues that were present in 3.0.7.

@nicovak
Copy link

nicovak commented Jun 14, 2018

@Nightsd01 Ok, thank you, I'll give It a try tomorrow with my actual setup 👍

@nicovak
Copy link

nicovak commented Jun 15, 2018

@Nightsd01 I tried to update to 3.2.4 again but impossible to get It work. I tried native initialization and javascript initialization. I put code in App componentWillMount and outside but nothing worked.
I spent enough time on It sorry, I'll give ^3.2.4 a try on a next project.

@Nightsd01
Copy link
Contributor

Figured out what is causing this issue @aspidvip @nicovak, it is resolved in a new PR. Should be included in a release either today or tomorrow.

@nicovak
Copy link

nicovak commented Jun 22, 2018

@Nightsd01 Thank you so much, you rock. I'll upgrade and test It next monday if it's available.

@Nightsd01
Copy link
Contributor

The new update (3.2.5) has been released! If anyone else encounters a similar issue please post here and we'll be happy to investigate

@nicovak
Copy link

nicovak commented Jul 31, 2018

I have the issue again with 0.56 version of react native.
I must be in 27 ? Docs says 26 should be working, right ?

    buildToolsVersion = "26.0.3"
    minSdkVersion = 16
    compileSdkVersion = 26
    targetSdkVersion = 26
    supportLibVersion = "26.1.0"
07-31 15:01:50.077 7068-7224/com.*************** I/art: Rejecting re-init on previously-failed class java.lang.Class<com.onesignal.OneSignalChromeTab$OneSignalCustomTabsServiceConnection>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/customtabs/CustomTabsServiceConnection;
        at void com.onesignal.OneSignalChromeTab.setup(android.content.Context, java.lang.String, java.lang.String, java.lang.String) (OneSignalChromeTab.java:46)
        at void com.onesignal.OneSignal$7.run() (OneSignal.java:1164)
        at void java.lang.Thread.run() (Thread.java:776)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.customtabs.CustomTabsServiceConnection" on path: DexPathList[[zip file "/data/app/com..***************-2/base.apk"],nativeLibraryDirectories=[/data/app/com..***************-2/lib/arm, /data/app/com..***************-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib, /system/vendor/lib, /product/lib]]
        at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
        at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
        at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
        at void com.onesignal.OneSignalChromeTab.setup(android.content.Context, java.lang.String, java.lang.String, java.lang.String) (OneSignalChromeTab.java:46)
        at void com.onesignal.OneSignal$7.run() (OneSignal.java:1164)
        at void java.lang.Thread.run() (Thread.java:776)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants