ele*_*o23 11 android intellij-idea
我在IntelliJ CE 2017.2上创建了一个新的Android项目并得到了这个错误.我按照答案中的说明添加了maven部分.
当我运行使用新项目创建的默认应用程序时,我收到错误
执行时出错:am startservice com.test.myapp/com.android.tools.fd.runtime.InstantRunService
启动服务:Intent {act = android.intent.action.MAIN cat = [android.intent.category.LAUNCHER] cmp = com.test.myapp/com.android.tools.fd.runtime.InstantRunService}
错误:app在后台uid为null
我仍然可以在我的手机上手动打开应用程序并且它可以工作,但它不会自动启动,我收到错误消息.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(intent);
}
else {
context.startService(intent);
}
Run Code Online (Sandbox Code Playgroud)
重要服务启动后,Service.startForeground()必须在 5 秒内调用。明显的地方是在onCreate
| 归档时间: |
|
| 查看次数: |
6065 次 |
| 最近记录: |