动态库so打包到android apk

基于Java的孕妇母婴知识交流分享系统开发实战 Java桌面应用开发中,如何将图形界面与数据库操作高效整合是常见挑战。通过Swing构建交互界面,配合MySQL存储业务数据,并以JDBC规范实现数据访问层,可形成一套完整的社区型系统解决方案。围绕基于Java的孕妇母婴知识交流分享系统,从数据库表设计、DAO封装到GUI事件联动,详细拆解知识浏览、评论收藏等核心功能的实现路径,剖析中文乱码、界面卡死等高频问题,并介绍HikariCP连接池优化,为课程设计与实际工程提供可复用的参考范式。 阅读详情

编译libjnisimple.so

 Android/development/samples/SimpleJNI/jni/Android.mk

# This makefile supplies the rules for building a library of JNI code for
# use by our example of how to bundle a shared library with an APK.

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := samples

# This is the target being built.
LOCAL_MODULE:= libsimplejni


# All of the source files that we will compile.
LOCAL_SRC_FILES:= \
  native.cpp

# All of the shared libraries we link against.
LOCAL_SHARED_LIBRARIES := \
        libutils

# No static libraries.
LOCAL_STATIC_LIBRARIES :=

# Also need the JNI headers.
LOCAL_C_INCLUDES += \
        $(JNI_H_INCLUDE)

# No special compiler flags.
LOCAL_CFLAGS +=

# Don't prelink this library.  For more efficient code, you may want
# to add this library to the prelink map and set this to true. However,
# it's difficult to do this for applications that are not supplied as
# part of a system image.

LOCAL_PRELINK_MODULE := false

include $(BUILD_SHARED_LIBRARY)

注意:在jni的C++代码中,JNI_OnLoad要用C编译器编译(extern "C"),否则会出现dalvik找不到JNI_OnLoad函数并跳过初始化。

D/dalvikvm( 4581): No JNI_OnLoad found in /data/data/xxxxlib/libsimplejni.so 0x481f3b78, skipping init 

编译apk
Android/development/samples/SimpleJNI/Android.mk

# This makefile shows how to build a shared library and an activity that
# bundles the shared library and calls it using JNI.

TOP_LOCAL_PATH:= $(call my-dir)

# Build activity

LOCAL_PATH:= $(TOP_LOCAL_PATH)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := samples

LOCAL_SRC_FILES := $(call all-subdir-java-files)

LOCAL_PACKAGE_NAME := SimpleJNI

LOCAL_JNI_SHARED_LIBRARIES := libsimplejni

LOCAL_PROGUARD_ENABLED := disabled

include $(BUILD_PACKAGE)

# ============================================================

# Also build all of the sub-targets under this one: the shared library.
include $(call all-makefiles-under,$(LOCAL_PATH))

注意:jni中实现的function,在java中必须要定义成native

编辑jni层文件编译so & apk

adb shell pm uninstall -f com.example.android.simplejni

adb install SimpleJNI.apk

android sdk 自带 实例(samples) List of Sample Apps The list below provides a summary of the sample applications that are available with the Android SDK. Using the links on this page, you can view the source files of the sample applications in your browser. You can also download the source of these samples into your SDK, then modify and reuse it as you need. For more information, see Getting the Samples. API Demos A variety of small applications that demonstrate an extensive collection of framework topics. Backup and Restore A simple example that illustrates a few different ways for an application to implement support for the Android data backup and restore mechanism. Bluetooth Chat An application for two-way text messaging over Bluetooth. BusinessCard An application that demonstrates how to launch the built-in contact picker from within an activity. This sample also uses reflection to ensure that the correct version of the contacts API is used, depending on which API level the application is running under. Contact Manager An application that demonstrates how to query the system contacts provider using the ContactsContract API, as well as insert contacts into a specific account. Home A home screen replacement application. JetBoy A game that demonstrates the SONiVOX JET interactive music technology, with JetPlayer. Live Wallpaper An application that demonstrates how to create a live wallpaper and bundle it in an application that users can install on their devices. Lunar Lander A classic Lunar Lander game. Multiple Resolutions A sample application that shows how to use resource directory qualifiers to provide different resources for different screen configurations. Note Pad An application for saving notes. Similar (but not identical) to the Notepad tutorial. SampleSyncAdapter Demonstrates how an application can communicate with a cloud-based service and synchronize its data with data stored locally in a content provider. The sample uses two related parts of the Android framework — the account manager and the synchronization manager (through a sync adapter). Searchable Dictionary A sample application that demonstrates Android's search framework, including how to provide search suggestions for Quick Search Box. Snake An implementation of the classic game "Snake." Soft Keyboard An example of writing an input method for a software keyboard. Spinner A simple application that serves as an application-under-test for the SpinnerTest sample application. SpinnerTest An example test application that contains test cases run against the Spinner sample application. To learn more about the application and how to run it, please read the Activity Testing tutorial. TicTacToeLib An example of an Android library project that provides a game-play Activity to any dependent application project. For an example of how an application can use the code and resources in an Android library project, see the TicTacToeMain sample application. TicTacToeMain An example of an Android application that makes use of code and resources provided in an Android library project. Specifically, this application uses code and resources provided in the TicTacToeLib library project. Wiktionary An example of creating interactive widgets for display on the Android home screen. Wiktionary (Simplified) A simple Android home screen widgets example. 立即下载

相关推荐

Android之动态库生成并打包到APK中(Windows下)

Android内核是Linux的,而linux的动态库是*.so文件,那么在windows要如何生成并打包到APK中呢?实现这一过程,大致需要以下几个步骤: 1、搭建编译环境 2、使用JNI生成相应的头文件 3、编写动态库的实现 4、生成动态库 5、编译调用动态库的代码 6、动态库打包到APK中 7、测试 具体可以参看该文http://blog.youkuaiyun.com/xxdddail/article/details/21515819

Android 平台Downloaded的源码及文档学习

Android N 7.1.1 1. android/developers/samples/ ├── AccelerometerPlay ├── Alarm ├── AliasActivity ├── AndroidBeamDemo ├── ApiDemos ├── AppNavigation ├── BackupRestore ├── BasicGLSurfaceV

好久不见 1117

嵌套交叉验证的‘双循环’哲学:为什么你的模型评估总是不准?

本文深入探讨了嵌套交叉验证(Nested Cross-Validation)在机器学习模型评估中的关键作用,揭示了传统交叉验证方法存在的偏差问题。通过双重循环设计,嵌套交叉验证有效隔离数据,提供无偏评估,显著提升模型在真实场景中的性能预测准确性。文章还提供了工程实践中的优化策略和量化分析,帮助开发者在计算成本与评估精度之间找到平衡。

b3n4m5q6w7的博客 224

Android 源码下利用jni编译自己的项目(参考系统development/samples/SimpleJNI)

记于正文前:环境是ubuntu10.10,android 源码是2.0的,在第一次编译源码的时候遇到不少问题,第二次一次make通过。                1)可能用到的文件或库全部安装(sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multili

qiuxiaolong007的专栏 6952

避坑指南:STM32CubeMX安装后,你的第一个工程为什么中文全是乱码?

本文详细解析了STM32CubeMX安装后中文乱码问题的根源及解决方案。从诊断乱码现象到分析编码冲突背景,提供了新项目UTF-8化、旧项目GBK兼容及版本降级等多种实用方案,帮助开发者彻底解决这一常见问题。

weixin_30699955的博客 474

基于Simulink的自适应控制(Adaptive Control)电励磁同步电动机

目录基于Simulink的自适应控制(Adaptive Control)电励磁同步电动机项目实例1. 项目背景2. 系统架构2.1 电励磁同步电动机模型2.2 三相逆变器模型2.3 自适应控制器(Adaptive Controller)2.4 系统框图3. 模型设计3.1 创建Simulink模型3.2 自适应控制(Adaptive Control)设计3.3 仿真环境搭建4. 参数优化4.1 自动调优5. 实际应用案例5.1 工业驱动系统5.2 风力发电系统6. 结论进一步优化建议需求分析电励磁同步电动机

MHD0815的博客 266

Android的应用程序结构分析:HelloActivity

[原创]Android的应用程序结构分析:HelloActivity (hanchao3c Android开发者论坛原创,转载请注明)本例以一个简单的HelloActivity程序为例,简单介绍Android应用程序的源代码结构。事实上,Android应用程序虽然不是很复杂,但是通常涉

况天宝的专栏 830

华为OD机试2025C卷-双十一最大花费金额[100分](Java_Python3_C++_C语言_JsNode_Go)实现100%通过率

双十一最大花费金额 - 动态规划解法 摘要:本文介绍了华为OD机试中"双十一最大花费金额"问题的动态规划解法。该问题要求在给定N件商品价格和优惠券面额X的情况下,选择若干商品使总花费不超过X且尽可能大。核心解法采用布尔型动态规划数组,记录每个金额是否可被拼出。算法时间复杂度为O(N*X),空间复杂度为O(X)。通过倒序遍历避免重复选择同一商品,最后从X向下查找第一个可达金额作为答案。文中提供了C++和Java的实现代码,并解释了与经典0-1背包问题的关系。 关键点: 问题本质是0-1背包/子集和问题的变体

2503_91057718的博客 46

Android之Windows下生成动态库so并打包到APK中

Android内核是Linux的,而linux的动态库是*.so文件,那么在windows要如何生成并打包到APK中呢?实现这一过程,大致需要以下几个步骤: 1、搭建编译环境 2、使用JNI生成相应的头文件 3、编写动态库的实现 4、生成动态库 5、编译调用动态库的代码 6、动态库打包到APK中 7、测试 下面就依据这些步骤一一进行实现。 1、搭建编译环境 要生成*.so的

学而时习之 6210

Windows 下 Codex 安装全记录:从零到一的保姆级图文教程

本文主要介绍了Windows 下 Codex 安装全记录:从零到一的保姆级图文教程,希望能对学习使用 Codex 的同学们有所帮助。 文章目录 1. 背景 2. 实战教程 2.1 方案一 2.2 方案二 3. 报错解决方案

weixin_43178406的博客 14万+

SAPFiori Elements Analytical List Page 概述

ALP(Analytical List Page)是SAP Fiori提供的一种复合页面类型,结合了分析(图表/KPI)与事务(表格/操作)功能,适用于需要分析后立即执行处理的业务场景(如采购价格监控、销售逾期处理等)。其核心价值在于让用户在同一页面完成从数据洞察到事务处理的闭环,减少应用切换带来的效率损耗。 页面结构包含页头KPI标签、交互式图表和明细表格,通过联动过滤、选择同步等机制实现数据钻取与即时操作。支持标准过滤和可视化过滤,并依赖OData注解(SelectionVariant/Presenta

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 267

Android 打包so动态库文件到APK

有时由于项目需要使用JNI来调用.so文件,需要将so文件一起打包到APK文件中,这有两种方法:   1. 使用mm命令和Android SDK源代码一起编译。 在project根目录创建一个Android.mk,文件内容如: [c-sharp] view plaincopy LOCAL_PATH:= $(call my-dir

android_xiaozhou的专栏 2478

【异常】OpenClaw报错 400 Total tokens of image and text exceed max message tokens. Request

OpenClaw报错400(Token超限)解决方案摘要 该报错因文本/图片总Token数超过模型限额导致,常见于多轮对话累积或单次请求过大。提供三级解决方案: 应急处理:输入"/new"指令清空会话历史,立即重置Token计数(90%问题可解决) 折中方案:保留历史对话前提下,通过精简当前输入、删除早期无关对话或拆分请求来压缩Token 专属处理:单次请求超限时,拆分长文本为2000字以内段落,或分批次上传降低分辨率图片 长期预防建议定期使用"/new"开启新会话,

奶爸的编程之路,也就一周冷个三天 1389

Android之Windows下生成动态库so并打包到APK中(转)

源:Android之Windows下生成动态库so并打包到APK中  

weixin_34232744的博客 113

效果炸裂_安装midscene_copw基于midscene操作电脑_基于视觉的软件测试执行_MIDSCENE的安装和使用---AI大模型应用探索0012

摘要:本文介绍了如何通过安装MidSceneJS来增强Copaw的屏幕操作能力。首先需要安装Node.js和npm,并配置淘宝镜像源加速安装。然后全局安装MidScene CLI工具(npm install @midscene/cli -g)。接着配置视觉大模型服务,通过设置环境变量指定模型API密钥、名称、基础URL和家族类型(如qwen3.5-27b),配置文件需存放在C:\Users\Administrator.copaw目录。安装成功后,MidScene已能成功识别并操作屏幕,使用效果良好。文中还提

添柴程序猿的专栏 638

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

Android Studio打包APK后动态库so文件被改动

本人项目中遇到一个非常奇葩的问题,百思不得其解。 问题是这样的: 由于项目是将C/C++层的代码与java代码分开管理的,所以C/C++代码没有放进AS里,编译时将在linux下编译好的动态库直接放进AS工程的jniLibs下再打包生成APK。问题来了。 AS 打包APK后,打开APK检查里面的so动态库,与工程目录下jniLibs存放的so对比MD5签名,发现不一致。 取

DonWZ的博客 9874

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

上一篇: UDP 收/发 广播包
下一篇: 搜集的好的文章
快乐的小鸟
博客等级 码龄14年 25粉丝 40原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值