[工作积累] Android dynamic library & JNI_OnLoad
Bionic libc doesn't load dependencies for current .so file (diff from Windows or Linux)
so a explicit calling of Java's System.loadLibrary() is needed, in order to load depedency libraries. otherwise the original .so will fail to load.
JNI_OnLoad will be called mostly on System.LoadLibrary() or equavilent calls
System.loadLibrary("gnustl_shared");
the .so file is loaded & and symbol get loaded by common dynamic library function:
if the symbol "JNI_OnLoad" is not found in the lib, dalvik will simply do nothing, but a Debug Log: No JNI_OnLoad found in xxx.so, skipping init.
details at:
NatvieAcitviy: JNI_OnLoad is not get called
For the startup library speicified by "android.app.lib_name", system will auto-load library on activity startup, but JNI_OnLoad is not get called, only libs loaded by System.loadLibrary() will.
but you can use native activity and load the library manually for the second time, so that JNI_OnLoad & all other activity binding function is exposed.
in AndroidManifest.xml:
<meta-data android:name="android.app.lib_name"
android:value="GameLibrary" />
in Game Activity.java - load it manually:
public class GameActivity extends NativeActivity {
....
static {
System.loadLibrary("GameLibrary");
}
}
[工作积累] Android dynamic library & JNI_OnLoad的更多相关文章
- [工作积累] android 中添加libssl和libcurl
1. libssl https://github.com/guardianproject/openssl-android 然后执行ndk-build 2.libcurl 源代码组织结构, 下面的mak ...
- [工作积累] Android: Hide Navigation bar 隐藏导航条
https://developer.android.com/training/system-ui/navigation.html View decorView = getWindow().getDec ...
- [工作积累] Android system dialog with native callback
JNI: invoke java dialog with native callback: store native function address in java, and invoke nati ...
- [工作积累] Google Play Services
注意添加APP_ID <meta-data android:name="com.google.android.gms.games.APP_ID" android:value= ...
- Android Support Library 学习入门
0. 文前闲话 作为一个由原生桌面应用程序开发者(VC.Delphi)转行的Android菜鸟,虐心的事真是数不胜数:安装个开发工具下载个SDK需要整整一夜:早晨一上班点开Android Studio ...
- Android Support Library
title: Android Support Library tags: Support Library,支持库 grammar_cjkRuby: true --- DATE: 2016-5-13. ...
- Android Support Library介绍
v4 Support Library 这个库是为Android 1.6(API版本为4)及以上的版本设计的,它包含大部分高版本中有而低版本中没有的API,包括application component ...
- As环境下添加android support library依赖库
2015年的google大会上,google发布了新的Android Support Design库的新组件之一,以此来全面支持Material Design 设计风格的UI效果,为了可以使用这些新颖 ...
- [Xamarin.Android] Support Library Tips
[Xamarin.Android] Support Library Tips Support Library支持内容 Xamarin Support Library每个版本支持.那些组件,可以参考这份 ...
随机推荐
- Apache 多端口多站点配置实例
分享下Apache多端口多站点的配置方法,配置apache服务器的朋友参考下. 配置httpd.conf 监听多个端口 复制代码代码如下: # Listen: Allows you to bind A ...
- ASP.NET MVC5学习笔记之Action参数模型绑定基本过程
当我们在Controller中定义一个Action,通常会定义一个或多个参数,每个参数称为一个模型,ASP.NET MVC框架提供了一种机制称为模型绑定,会尝试自动从请求的信息中实例化每一个模型并赋值 ...
- dump buffer cache
1.基础内容: ALTER SESSION SET EVENTS 'immediate trace name buffers level n'; n取值意义: 1 只转储buffer header. ...
- 第一个MySQL 存储过程
昨天写了人生第一个mysql存储过程:遗憾的是,这个存储过程最后还是没用上,用php代码替代 话说mysql的存储过程真是反人类,不查reference,基本不能看懂那些语句:语言中能和它相比的,只有 ...
- Python核心编程--学习笔记--6--序列(上)字符串
本章研究Python中的序列:字符串.列表和元组.因为这些类型其实都是由一些成员共同组成的一个序列整体,所以我们把它们统称为序列.序列的存储结构可以表示为: 1 序列 序列类型有着相同的访问模式:按下 ...
- python-抓取图片
今天看到博客园一个文章,python抓取图片,也没看内容,心想自己也写一个抓取脚本试试看,一方面自己也在学习python,另一方面毕竟实际工作也经常会遇到这种需要临时写脚本的时候,突击锻炼还是好的嘛. ...
- MongoDB牛刀小试
MongoDB基本操作 1.MongoDB的启动 首先创建一个目录作为MongoDB的工作目录: 进入MongoDB的bin目录: 执行mongod命令,使用参数--dbpath指定MongoDB的工 ...
- Apache+tomcat集群配置
一.软件准备 Apache 2.2 : http://httpd.apache.org/download.cgi,下载msi安装程序,选择no ssl版本 Tomcat 6.0 : http://to ...
- poj 1985 Cow Marathon
题目连接 http://poj.org/problem?id=1985 Cow Marathon Description After hearing about the epidemic of obe ...
- java与IOS之间的RSA加解密
很简单的一个需求,ipad端给密码RSA加密,传到java后台,解密.RSA加密算法是基于一个密钥对的,分为公钥和私钥,一般情况公钥加密,私钥解密,但也可私钥加密,公钥解密.还可以验签,就是先用私钥对 ...