Click here to Skip to main content
15,888,461 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get application stopped working error only on api 27, on api 26 it works fine.
I'm using android studio 3.1.0.
Please help.
Thanks.

What I have tried:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "com.hataflabs.batterywidget"
        minSdkVersion 18
        targetSdkVersion 27
        versionCode 1
        versionName "260816"
    }
    repositories {
        mavenLocal()
        mavenCentral()
        google()
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    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:27.0.0'
    implementation 'com.android.support:appcompat-v7:27.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}
Posted
Comments
Kornfeld Eliyahu Peter 9-Apr-18 15:01pm    
Have you used the debugger? There is any error? Log?
David Crow 9-Apr-18 16:24pm    
Ummm, what exception is being thrown?
Member 10850253 10-Apr-18 14:22pm    
<pre>
//Error
04-10 12:13:10.619 4089-4089/com.hataflabs.batterywidget:remote E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.hataflabs.batterywidget:remote, PID: 4089
    android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=Battery Service pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Seal2002 30-Oct-18 11:15am    
what is your device emulator ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900