android - 错误 : app is in background uid null

标签 android intellij-idea

我在 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/

相关文章:

java - 无法在Intellij Ultimate Edition 2017中创建新的Gradle项目

java - IntelliJ IDEA ."Open existing project"与 "delete existing and reimport"

java - JavaFX 中 ImageView 中的 setImage() 正确的图像参数是什么?

android - 如何将带有 ViewPager 的 Tablayout 放入属于抽屉导航的 fragment 内

jQuery 还是 jQuery Mobile?

java - eclipse 中的 Junit 在使用 junit 时产生 NoClassDefFoundError

javascript - 从 Android 浏览器触发 Google map

android 内部套接字连接因守护进程服务失败

android - 使用 IntelliJ 编译 ViewPagerIndicator 示例

intellij-idea - 编写Intelli-J检查吗?