我在 IntelliJ CE 2017.2 上创建了一个新的 Android 项目并获得了 this error .我按照答案中的描述添加了 Maven 部分。
当我运行使用新项目创建的默认应用程序时出现错误
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
我仍然可以在我的手机上手动打开该应用程序并且它可以运行,但它不会自动启动并且我收到该错误消息。
最佳答案
我在使用 android api 26/27 (Oreo) 时看到过这个错误。奥利奥有新的background execution limits . tl;dr 你应该在前台运行服务。
要使用 adb 启动您的服务,请使用 adb shell am start-foreground-service
代替 adb shell am startservice
。
关于android - 错误 : app is in background uid null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47209662/