OneSignal / OneSignal-Gradle-Plugin

Use with OneSignal-Android-SDK to help integrate it into your Android Studio or Gradle project. https://onesignal.com
Other
64 stars 17 forks source link

Fatal Exception: java.lang.NoSuchMethodError: No static method getLong #64

Closed fazalBykea closed 6 years ago

fazalBykea commented 6 years ago

Project Setup

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.0'
        classpath 'io.fabric.tools:gradle:1.25.4'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        /*maven {
            url 'https://maven.google.com/'
        }*/
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext {
    minSdkVersion = 16
    targetSdkVersion = 26
    compileSdkVersion = 27
    buildToolsVersion = '27.0.3'
    supportLibraryVersion = '27.1.1'
}

app/build.gradle

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig.applicationId = "xxx.xxx.xxx"

    defaultConfig {
        applicationId "xxx.xxx.xxx"
        manifestPlaceholders = [onesignal_app_id               : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                                onesignal_google_project_number: "REMOTE"]
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 25
        versionName "4.32"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
        setProperty("archivesBaseName", "bykea-user-v" + defaultConfig.versionName + "-" + releaseTime())
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    signingConfigs {
        debug {

        }
        release {

        }
    }
    buildTypes {
        release {

        }
        debug {

        }

        flavorDimensions "passenger"
        productFlavors {
            local {
                dimension "passenger"
                buildConfigField "String", "FLAVOR_URL", "URL-LOCAL"
            }
            staging {
                dimension "passenger"
                //buildConfigField "String", "FLAVOR_URL", "URL-STAGING""
                buildConfigField "String", "FLAVOR_URL", "URL-STAGING"
            }
            livetesting {
                dimension "passenger"
                buildConfigField "String", "FLAVOR_URL", "URL-LIVETESTING"
            }
            production {
                dimension "passenger"
                buildConfigField "String", "FLAVOR_URL", "URL-PRODUCTION"
            }
        }

        applicationVariants.all { variant ->
            variant.mergedFlavor.versionName = android.defaultConfig.versionName + "-" + releaseTime()
            variant.outputs.all { output ->
                def apkName = "bykea-user-v" + variant.mergedFlavor.versionName + "-c" + android.defaultConfig.versionCode

                apkName += "-" + variant.productFlavors[0].name + "-" + variant.buildType.name
                apkName += ".apk"

                outputFileName = new File("../../" + apkName)
            }
        }
    }
    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support') {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion '27.1.1'
                }
            }
        }
    }
}

static def releaseTime() {
    return new Date().format("MMM-dd")
}

repositories {
    jcenter()
    maven { url "https://maven.google.com" }
    maven { url "https://jitpack.io" }
}
dependencies {

    testImplementation 'junit:junit:4.12'

    implementation 'com.android.support:support-v4:27.1.1'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation('io.socket:socket.io-client:1.0.0') {
        // excluding org.json which is provided by Android
        exclude group: 'org.json', module: 'json'
    }
    implementation('com.instabug.library:instabug:4.15.2') {
        exclude group: 'com.google.android.gms'
    }
    implementation('com.onesignal:OneSignal:[3.9.1, 3.99.99)') {
        exclude group: 'com.google.android.gms'
    }
    //    implementation 'org.jsoup:jsoup:1.10.1'
    //    debugimplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
//    releaseimplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
    implementation "com.android.support:cardview-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
    implementation "com.android.support:customtabs:$rootProject.supportLibraryVersion"
    implementation "com.android.support:design:$rootProject.supportLibraryVersion"
    implementation "com.android.support:support-v4:$rootProject.supportLibraryVersion"

    implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'org.greenrobot:eventbus:3.0.0'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'commons-lang:commons-lang:2.6'
    implementation 'com.jakewharton:butterknife:8.8.1'
    implementation 'com.squareup.retrofit:retrofit:2.0.0-beta2'
    implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
    implementation 'com.squareup.okhttp:logging-interceptor:2.6.0'
    implementation 'com.intuit.sdp:sdp-android:1.0.5'
    implementation 'com.wang.avi:library:2.1.3'
    implementation 'com.google.maps:google-maps-services:0.1.6'
    implementation 'com.thefinestartist:finestwebview:1.2.7'
    implementation 'com.google.android.gms:play-services:12.0.1'
    implementation 'com.google.firebase:firebase-core:12.0.1'
    implementation 'com.google.firebase:firebase-messaging:12.0.1'
    implementation('com.google.android.gms:play-services-analytics:12.0.1') {
        exclude group: 'com.google.android.gms'
    }
    implementation 'com.mixpanel.android:mixpanel-android:5.4.0'
    implementation 'com.github.jd-alexander:library:1.1.0'
    implementation 'com.google.maps.android:android-maps-utils:0.3.4'
    implementation 'com.facebook.android:facebook-android-sdk:4.19.0'
    implementation 'com.google.android.exoplayer:exoplayer:r1.5.3'
    implementation 'me.grantland:autofittextview:0.2.1'
    implementation 'com.google.dagger:dagger:2.14.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.romandanylyk:pageindicatorview:0.2.0'
    implementation 'cn.lightsky.infiniteindicator:library:1.2.2'
    implementation 'com.eftimoff:android-viewpager-transformers:1.0.1@aar'
    implementation 'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.tomer:fadingtextview:2.5'
    implementation 'top.oply.opuslib:opuslib:1.0.2'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.4'
    implementation 'com.facebook.shimmer:shimmer:0.1.0@aar'
    implementation 'com.github.sharish:ShimmerRecyclerView:v1.3'
//    implementation 'com.scottyab:aescrypt:0.0.1'
//    implementation 'com.pddstudio:urlshortener:1.0.2'

    //    implementation 'com.scottyab:aescrypt:0.0.1'
    //    implementation 'com.pddstudio:urlshortener:1.0.2'
    implementation 'com.github.takusemba:multisnaprecyclerview:1.3.3'

    //**************************** Log ********************** //
    implementation 'com.elvishew:xlog:1.4.1'
}
apply plugin: 'com.google.gms.google-services'

Full Error

Fatal Exception: java.lang.NoSuchMethodError: No static method getLong(Ljava/lang/String;Ljava/lang/String;J)J in class Lcom/onesignal/OneSignalPrefs; or its super classes (declaration of 'com.onesignal.OneSignalPrefs' appears in base.apk:classes2.dex)
       at com.onesignal.OneSignal.GetUnsentActiveTime(SourceFile:2728)
       at com.onesignal.OneSignalSyncServiceUtils.internalSyncOnFocusTime(SourceFile:169)
       at com.onesignal.OneSignalSyncServiceUtils.syncOnFocusTime(SourceFile:163)
       at com.onesignal.OneSignalSyncServiceUtils$SyncRunnable$1.complete(SourceFile:229)
       at com.onesignal.LocationGMS.fireComplete(SourceFile:254)
       at com.onesignal.LocationGMS.fireFailedComplete(SourceFile:239)
       at com.onesignal.LocationGMS$2.run(SourceFile:220)
       at java.lang.Thread.run(Thread.java:762)

Device Data

Device Brand: samsung Model: SM-G610F Orientation: Portrait RAM free: 387.61 MB Disk free: 1.03 GB Operating System Version: 7.0 Orientation: Portrait Rooted: No Crash Date: Sep 9, 2018, 10:47:30 PM App version: 4.32 (25)

Your help will be highly appreciated

jkasten2 commented 6 years ago

@fazalBykea Thanks for reporting this issue. This crash is related to the OneSignal-Android-SDK. Can you open a new issue on the OneSignal-Android-SDK repo? We can follow up with you there. Thanks.