OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
604 stars 368 forks source link

FATAL EXCEPTION: OS_REST_SUCCESS_CALLBACK #1459

Closed javierbentez closed 2 years ago

javierbentez commented 2 years ago

Description:

When my app try to set onesignal app id, it crash and I get this error:

2021-10-17 18:17:45.645 28353-28672/? E/AndroidRuntime: FATAL EXCEPTION: OS_REST_SUCCESS_CALLBACK
    Process: example.com, PID: 28353
    java.lang.VerifyError: Verifier rejected class androidx.work.impl.OperationImpl: com.google.common.util.concurrent.ListenableFuture androidx.work.impl.OperationImpl.getResult() failed to verify: com.google.common.util.concurrent.ListenableFuture androidx.work.impl.OperationImpl.getResult(): [0x2]  can't resolve returned type 'Unresolved Reference: com.google.common.util.concurrent.ListenableFuture' or 'Unresolved Reference: androidx.work.impl.utils.futures.SettableFuture' (declaration of 'androidx.work.impl.OperationImpl' appears in /data/app/~~J82UPx1RDDQpWm9c0fgoBQ==/example.com-vE1sYQs06t8TnXNdY1nwbg==/base.apk)
        at androidx.work.impl.utils.EnqueueRunnable.<init>(EnqueueRunnable.java:79)
        at androidx.work.impl.WorkContinuationImpl.enqueue(WorkContinuationImpl.java:186)
        at androidx.work.impl.WorkManagerImpl.enqueueUniqueWork(WorkManagerImpl.java:407)
        at androidx.work.WorkManager.enqueueUniqueWork(WorkManager.java:351)
        at com.onesignal.OSNotificationRestoreWorkManager.beginEnqueueingWork(OSNotificationRestoreWorkManager.java:49)
        at com.onesignal.OneSignal.handleActivityLifecycleHandler(OneSignal.java:931)
        at com.onesignal.OneSignal.init(OneSignal.java:808)
        at com.onesignal.OneSignal.setAppId(OneSignal.java:691)
        at com.onesignal.OneSignal.reassignDelayedInitParams(OneSignal.java:1127)
        at com.onesignal.OneSignal.onRemoteParamSet(OneSignal.java:845)
        at com.onesignal.OneSignal$6.complete(OneSignal.java:1068)
        at com.onesignal.OneSignalRemoteParams.processJson(OneSignalRemoteParams.java:206)
        at com.onesignal.OneSignalRemoteParams.access$100(OneSignalRemoteParams.java:12)
        at com.onesignal.OneSignalRemoteParams$1.onSuccess(OneSignalRemoteParams.java:151)
        at com.onesignal.OneSignalRestClient$5.run(OneSignalRestClient.java:269)
        at java.lang.Thread.run(Thread.java:923)

Environment

minSdkVersion 23 targetSdkVersion 30 (I've tried to change it to 31 also) I've added reproducing the steps in the android docs. Yesterday, with the same code, worked.

Steps to Reproduce Issue:

  1. Execute the line: OneSignal.setAppId("HERE IS MY APP ID");
nan-li commented 2 years ago

Hi @elmundomusical4,

Can you share the following information please:

You can try deleting your gradle cache ~/.gradle/caches/ Also, may be worth trying these steps:

  1. Exit Studio.
  2. Delete .idea/, build/, app/build directories.
  3. Start Studio
  4. Clean & rebuild project.
javierbentez commented 2 years ago

APP/BUILD.GRADLE:

plugins {
    id 'com.onesignal.androidsdk.onesignal-gradle-plugin'
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion '30.0.2'

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

    defaultConfig {
        applicationId "com.javir3tics"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode 34
        versionName 'BETA 3.0 (4)'

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        def contentProviderAuthority = "com.javir3tics.provider.StickerContentProvider"
        manifestPlaceholders contentProviderAuthority: contentProviderAuthority
        // Adds a new field for the authority to the BuildConfig class.
        buildConfigField("String", "CONTENT_PROVIDER_AUTHORITY", "\"${contentProviderAuthority}\"")
    }

    buildTypes {
        release {
            manifestPlaceholders contentProviderAuthority: 'contentProviderAuthority'
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            crunchPngs false
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    implementation 'androidx.navigation:navigation-fragment:2.3.5'
    implementation 'androidx.navigation:navigation-ui:2.3.5'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

    // Bottom Navigation
    implementation 'com.github.ismaeldivita:chip-navigation-bar:1.3.4'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.5.30'

    implementation("com.squareup.okhttp3:okhttp:4.9.1")

    implementation 'com.google.code.gson:gson:2.8.6'
    implementation 'com.jayway.jsonpath:json-path:2.6.0'

    implementation 'androidx.browser:browser:1.3.0'
    implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

    implementation "com.orhanobut:hawk:2.0.1"
    implementation 'androidx.emoji:emoji:1.1.0'

    implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.2.2'
    implementation 'androidx.browser:browser:1.3.0'

    implementation "com.airbnb.android:lottie:3.7.0"
    implementation 'de.hdodenhof:circleimageview:3.1.0'

    // Material Dialog Library
    implementation 'dev.shreyaspatil.MaterialDialog:MaterialDialog:2.2.2'

    implementation 'com.github.Spikeysanju:MotionToast:1.3.3.4'

    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation 'com.google.android.play:core:1.10.2'

    // For Kotlin users also add the Kotlin extensions library for Play Core:
    implementation 'com.google.android.play:core-ktx:1.8.1'

    implementation 'com.sun.mail:android-mail:1.6.0'
    implementation 'com.sun.mail:android-activation:1.6.0'

    implementation 'com.jcminarro:RoundKornerLayouts:0.4.0'

    implementation 'com.github.angads25:toggle:1.1.0'

    implementation 'com.onesignal:OneSignal:[4.0.0, 4.99.99]'

    implementation 'com.scottyab:rootbeer-lib:0.1.0'

    implementation "androidx.security:security-crypto:1.0.0-rc04"

    implementation "androidx.work:work-runtime:2.2.0"
}

BUILD.GRADLE:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.3'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        gradlePluginPortal()
        mavenCentral()
        maven { url 'https://jitpack.io' }

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
nan-li commented 2 years ago

Hi @elmundomusical4,

It looks like this dependency implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava' is causing the issue where it can't resolve ListenableFuture, which seems to be coming from com.google.guava:listenablefuture when I look in Studio .

Remove that dependency and it should work.

javierbentez commented 2 years ago

So thanks!! It is now fixed!! 😃😃