所以我写了一个 go 文件,它将动态附加一个库到 apex_defaults-> multilib -> first -> native_shared_libs; Android.bp可以在此处查看完整代码。但是,我无法像生成的其他 lib .so 文件一样在我的 out 目录中看到已编译的 .so 文件。
长解释:
我想向数组native_shared_libs添加一个名为“libabcxtractor”的库;就此而言,我写了一个.go文件(由 Google 推荐),其条件如下:
package my_apex
import (
"android/soong/android"
"android/soong/apex"
"fmt"
"strings"
)
func globalFlags(ctx android.BaseContext) []string {
var native_shared_libs []string
if(strings.Contains(ctx.AConfig().DeviceName(), "my_apex_device")){
fmt.Println("Some log to verify condition is getting executed......")
native_shared_libs = append(native_shared_libs, "libabcextractor")
}
return native_shared_libs
}
func myApexFlagsDefaults(ctx android.LoadHookContext) {
type props struct {
Multilib struct {
First struct {
native_shared_libs []string
} …Run Code Online (Sandbox Code Playgroud)