1 jar
- 用于编译 Java 代码并生成 .jar 文件。一般情况下,Android.bp 文件中会定义多个 jar 模块,每个 jar 模块对应着一个 Java 库
java_library {
name: "mylibrary",
srcs: ["src/**/*.java"],
manifest: "AndroidManifest.xml",
}
2 apk
- 用于编译 Android 应用程序并生成 .apk 文件
android_app {
name: "myapp",
srcs: ["src/**/*.java"],
resource_dirs: ["res"],
manifest: "AndroidManifest.xml",
certificate: "mykey",
}
3 shared_library
- 用于编译 C/C++ 代码并生成共享库(.so 文件)
cc_library_shared {
name: "mylibrary",
srcs: ["src/**/*.cpp"],
shared_libs: ["libfoo"],
include_dirs: ["include"],
}
4 static_library
cc_library_static {
name: "mylibrary",
srcs: ["src/**/*.cpp"],
include_dirs: ["include"],
}
5 java_binary
- 用于编译 Java 代码并生成可执行的 Java 程序(.jar 文件)
java_binary {
name: "myprogram",
srcs: ["src/**/*.java"],
main_class: "com.example.Main",
manifest: "AndroidManifest.xml",
}
6 cc_binary
- 用于编译 C/C++ 代码并生成可执行的 C/C++ 程序
cc_binary {
name: "myprogram",
srcs: ["src/**/*.cpp"],
cflags: ["-Wall"],
ldflags: ["-lfoo"],
shared_libs: ["libbar"],
}