深入浅出Android makefile(4)--LOCAL_STATIC_LIBRARIES

本文详细探讨了Android构建系统中LOCAL_STATIC_LIBRARIES的使用,揭示了它如何帮助链接静态库到Android应用或库项目中。通过实例解析,解释了配置LOCAL_STATIC_LIBRARIES的过程及其在构建过程中的作用,为Android开发者提供了深入的指导。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

上文我们讲完LOCAL_SRC_FILES,下面我们就一步步来梳理下LOCAL_STATIC_LIBRARIES。

一、 初识LOCAL_STATIC_LIBRARIES
我们首先看看该变量在NDK文档中的定义:
LOCAL_STATIC_LIBRARIES
     应该链接到这个模块的静态库列表(使用 BUILD_STATIC_LIBRARY 生成),这仅仅对共享库模块才有意义。
    The list of static libraries modules (built with BUILD_STATIC_LIBRARY) that should be linked to this module. This only makes sense in shared library modules.
最后一句“这仅仅对共享库模块才有意义”我们先不管,从上述定义中我们知道,LOCAL_STATIC_LIBRARIES肯定是描述了编译当前模块需要的静态库。

在acp模块的编译文件Android.mk中有LOCAL_STATIC_LIBRARIES的定义:LOCAL_STATIC_LIBRARIES := libhost,也就是描述了要编译本模块,必须已经先编译了libhost.a静态库。
但是如果我没有编译出libhost.a静态库,为什么会报 *** No rule to make target `out/host/linux-x86/obj/STATIC_LIBRARIES/lib
好的,下面为您介绍一个简单的Spring Boot + Mybatis Plus(SSMP)整合案例。 1. 首先,在pom.xml文件中添加以下依赖: ```xml <!--Spring Boot 依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--Mybatis Plus 依赖--> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>${mybatis-plus.version}</version> </dependency> <!--MySQL 驱动--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> </dependency> ``` 2. 在application.properties中配置数据源: ```properties # 数据库配置 spring.datasource.url=jdbc:mysql://localhost:3306/mybatis_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.username=root spring.datasource.password=123456 spring.datasource.driver-class-name=com.mysql.jdbc.Driver ``` 3. 创建一个实体类User,用于映射数据库中的user表: ```java @Data public class User { private Long id; private String name; private Integer age; private String email; } ``` 4. 创建UserMapper接口,用于定义数据库操作: ```java public interface UserMapper extends BaseMapper<User> { } ``` 5. 创建UserService类,用于定义业务逻辑: ```java @Service public class UserService { @Autowired private UserMapper userMapper; public List<User> selectList() { return userMapper.selectList(null); } public User selectById(Long id) { return userMapper.selectById(id); } public int insert(User user) { return userMapper.insert(user); } public int update(User user) { return userMapper.updateById(user); } public int delete(Long id) { return userMapper.deleteById(id); } } ``` 6. 创建UserController类,用于处理HTTP请求: ```java @RestController @RequestMapping("/user") public class UserController { @Autowired private UserService userService; @GetMapping("/list") public List<User> selectList() { return userService.selectList(); } @GetMapping("/{id}") public User selectById(@PathVariable Long id) { return userService.selectById(id); } @PostMapping public int insert(@RequestBody User user) { return userService.insert(user); } @PutMapping public int update(@RequestBody User user) { return userService.update(user); } @DeleteMapping("/{id}") public int delete(@PathVariable Long id) { return userService.delete(id); } } ``` 7. 启动应用程序,访问http://localhost:8080/user/list可以获取所有用户的列表,访问http://localhost:8080/user/1可以获取id为1的用户的详细信息。 以上就是一个简单的Spring Boot + Mybatis Plus(SSMP)整合案例,希望能帮助到您。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值