Error: app is in background uid null

Viewed 14036

I created a new Android project on IntelliJ CE 2017.2 and got this error. I added the maven section as described in the answer.

When I run the default app that is created with the new project I get the error

Error while executing: am startservice com.test.myapp/com.android.tools.fd.runtime.InstantRunService

Starting service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.test.myapp/com.android.tools.fd.runtime.InstantRunService }

Error: app is in background uid null

I can still open the app manually on my phone and it works, but it doesn't start automatically and I get that error message.

2 Answers

I've seen this error using android api 26/27 (Oreo). In Oreo there are new background execution limits. tl;dr you should run services in the foreground.

to start your service using adb, use adb shell am start-foreground-service

instead of adb shell am startservice.

Related