android - change name of native shared library AAR and binary in android studio
问题描述
I'm building a shared library AAR in Anroid Studio (3.4.2)
the name of the build is app-debug_-debug.aar
- the project is called app
- how do I change the name of the project to foobar
so that my library will be called foobar-debug_-debug.aar
also the binary of library.so file with the is called libjni_lib.so
and i'd like to rename that to libbarbaz.so
too
how to do this?
解决方案
要更改二进制名称,我必须做两件事
1)更改文件BINARY_NAME
中的CMakeLists.txt
cmake_minimum_required(VERSION 3.4.1)
SET(BINARY_NAME "my_new_binary_name")
然后在几个地方使用它
add_library( ${BINARY_NAME}
...
target_link_libraries( ${BINARY_NAME}
2)更改System.loadLibrary
以调用我的新二进制名称
public class Java
{
static
{
System.loadLibrary ("my_new_binary_name");
}
public native static void initialiseMyAPP (Context appContext);
}
为了更改库名称,我在复制文件时将文件重命名为主机目标
rename { String fileName ->
fileName.replace("old_library_name.aar", "new_library_name.aar")
}
``
推荐阅读
- python - 在 Jupyter 中使用 unixODBC 连接到 SQL Server 数据库
- formatting - 无法通过与 gnu plot 中的下轴链接来获取上轴值
- powershell - Import-DbaCsv 工具中的 -Encoding 参数有哪些选项?
- swift - Swift - 按下时标签栏控制器不显示
- javascript - 轮播滑块不更改图像
- c++ - 每次改变常数,结果都不一样
- mysql - XAMPP MySQL 访问被拒绝 ** 仅当未连接到 Internet 时**
- reflection - 从未知对象(.net)生成一个招摇文件
- node.js - Watson Assistant 日志错误“超出速率限制”
- python - 根据它们在另一个数据帧中的频率将值附加到一个数据帧