Android.bp里实现user版本中不打包adbd服务
时间: 2024-03-23 12:41:09 浏览: 13
在 Android.bp 文件中,可以使用 `exclude_from_all` 属性来指定不应该被打包的文件或服务。因此,你可以在 `exclude_from_all` 中指定只有在 `userdebug` 和 `eng` 版本中才会打包 adbd 服务。
例如,以下的例子演示了如何在 `userdebug` 和 `eng` 版本中打包 adbd 服务,而在 `user` 版本中不打包它:
```
android_app {
name: "example_app",
srcs: ["example_app.cpp"],
exclude_from_all: true,
target: {
android: {
userdebug: {
exclude_from_all: false,
},
eng: {
exclude_from_all: false,
},
user: {
exclude_from_all: true,
},
},
},
...
services: ["adbd"],
}
```
在上面的例子中,`exclude_from_all` 属性指定了该应用程序是否应该被打包,`target` 属性指定了不同版本的 Android 中是否应该打包该应用程序。在 `user` 版本中,`exclude_from_all` 属性被设置为 `true`,因此该应用程序不会被打包,其中包括 adbd 服务。