0

In my apps i used a service class for sync data from my server. It's working fine before for all type device. Now it's work only for 26+ SDK device, and crushed on 25 and lower SDK. It's crushed when execute startService(intent). And can't get any exception in try catch .

Here is my activity code :

try {
                if(!isMyServiceRunning(SyncdataService.class)){
                    Intent intent = new Intent(this, SyncdataService.class);
                    stopService(intent);
                    startService(intent);
                }
            }catch (Exception e){
                Log.d("Exception", "Error: " + e.toString());
            }

And This is my Gradel :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.catalystconnect.catalystconnect"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    useLibrary 'org.apache.http.legacy'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })


    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support:support-vector-drawable:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v4:26.+'
    compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.+'
    compile 'me.leolin:ShortcutBadger:1.1.8'
    compile 'com.google.firebase:firebase-core:10.0.1'
    testCompile 'junit:junit:4.12'


    compile 'com.twilio:voice-android:2.0.4'
    compile 'com.android.support:design:26.0.2'
    compile 'com.android.support:appcompat-v7:26.0.2'
    compile 'com.squareup.retrofit:retrofit:1.9.0'
    compile 'com.koushikdutta.ion:ion:2.1.8'
    compile 'com.google.firebase:firebase-messaging:10.0.1'
}

apply plugin: 'com.google.gms.google-services'

Why this happen ?

Mahidul Islam
  • 580
  • 11
  • 29

0 Answers0