android9.0-ndk开发(1)-第三方库的生成

这篇博客介绍了在Android 9.0中使用NDK进行第三方库的生成过程,包括下载NDK,创建Android.mk和Application.mk文件,配置ABI以支持不同指令集,并详细讲解了编译步骤及目录结构。
摘要由CSDN通过智能技术生成


注1:android9.0-ndk开发系列文档提供一个ndk编译JNI库,并访问第三方库,APP 直接通过jar接口调用的方法。
注2:本文为个人学习记录,可能存在个别或多处错误,欢迎指正和讨论。
android9.0-ndk开发(1)-第三方库的生成
android9.0-ndk开发(2)-JNI代码
android9.0-ndk开发(3)-Jar打包
android9.0-ndk开发(4)-APP 调用实例

一、流程图

流程如下:
流程图

二、ndk库的生成(第三方库)

2.1 ndk下载:

https://developer.android.google.cn/ndk/downloads/
我这里选择的是Linux 64 位 (x86) android-ndk-r20-linux-x86_64.zip版本
使用以下命令后,即可使用ndk-build编译工具

export PATH=/home/ttx/work_runtime/alex/android-ndk-r20:$PATH

查看ndk-build

$ ndk-build -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

2.2 sample.cpp

/*
 * Copyright (C) 2019 Alex
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值