[工作积累] 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每个版本支持.那些组件,可以参考这份 ...
随机推荐
- 复习后台代码(与前面clentHttp连接网络结合)
package com.zzw.LoginServelt; import java.io.IOException; import java.io.PrintWriter; import javax.s ...
- android获取com.android.internal.R
使用class.jar, layout.jar可以直接导入com.android.internal.R 但是有个方法获取不到值mDatePicker.findViewById(com.android. ...
- 2.python的变量与赋值
首先,为何要使用变量这里就不再多说了,我这里就介绍一下变量的命令规则和变量赋值的内存行为. 1.变量的命名规则 变量其实通过一个标记调用内存中的值,而变量名就是这个标记的名称,但是万一这个标记已经被提 ...
- 苹果内付费 IAP
创建app内购买项目 消耗型项目:对于消耗型App内购买项目,用户每次下载时都必须进行购买.一次性服务通常属于消耗型项目,例如钓鱼App 中的鱼饵. 非消耗型项目:对于非消耗型App内购买项目,用户仅 ...
- CK表达式编辑器
1. 什么是表达式编辑器? 这个工具允许技术员传入一系列的参数,由用户编辑一个公式返回一种特定的结果.之所以需要使用表达式编辑器,就是因为用户编辑的公式经常变,技术员无法想出一办法来适应用户 ...
- .net 面试问题 汇总
用.net做B/S结构的系统,您是用几层结构来开发,每一层之间的关系以及为什么要这样分层? 答: 从下至上分别为:数据访问层.业务逻辑层(又或成为领域层).表示层 数据访问层:有时候也称为是持久层,其 ...
- mysql查看日志
工具:mysqlbinlog, 在bin目录中日志在data目录中 日志过滤:mysqlbinlog mysql-bin.000011 | less mysqlbinlog mysql-bin.000 ...
- Win7下的本地网站发布
今天闲来无事研究了一下网站的发布,之前一直以为很难的样子,当真正实现了就觉得他也不过如此,现在来把我的研究结果分享一下,如果有问题望大家提出来! 首先发布网站我们要在本地的电脑上安装IIS,这个就不多 ...
- Oracle小技巧
Oracle纵向变横向,多行变一行 取处方下的药品大类,以 处方 药品大类 a001 中药.西药,中成药的 的格式显示 /*处方与药品大类的对应 周璇球 20130829*/ SELEC ...
- 【收藏】Myeclipse优化
1 .关闭MyEclipse的自动validation windows > perferences > myeclipse > validation 将Bui ...