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:

dlopen

dlsym

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:

dalvik/vm/Native.c

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的更多相关文章

  1. [工作积累] android 中添加libssl和libcurl

    1. libssl https://github.com/guardianproject/openssl-android 然后执行ndk-build 2.libcurl 源代码组织结构, 下面的mak ...

  2. [工作积累] Android: Hide Navigation bar 隐藏导航条

    https://developer.android.com/training/system-ui/navigation.html View decorView = getWindow().getDec ...

  3. [工作积累] Android system dialog with native callback

    JNI: invoke java dialog with native callback: store native function address in java, and invoke nati ...

  4. [工作积累] Google Play Services

    注意添加APP_ID <meta-data android:name="com.google.android.gms.games.APP_ID" android:value= ...

  5. Android Support Library 学习入门

    0. 文前闲话 作为一个由原生桌面应用程序开发者(VC.Delphi)转行的Android菜鸟,虐心的事真是数不胜数:安装个开发工具下载个SDK需要整整一夜:早晨一上班点开Android Studio ...

  6. Android Support Library

    title: Android Support Library tags: Support Library,支持库 grammar_cjkRuby: true --- DATE: 2016-5-13. ...

  7. Android Support Library介绍

    v4 Support Library 这个库是为Android 1.6(API版本为4)及以上的版本设计的,它包含大部分高版本中有而低版本中没有的API,包括application component ...

  8. As环境下添加android support library依赖库

    2015年的google大会上,google发布了新的Android Support Design库的新组件之一,以此来全面支持Material Design 设计风格的UI效果,为了可以使用这些新颖 ...

  9. [Xamarin.Android] Support Library Tips

    [Xamarin.Android] Support Library Tips Support Library支持内容 Xamarin Support Library每个版本支持.那些组件,可以参考这份 ...

随机推荐

  1. Java transient volatile关键字(转)

    Volatile修饰的成员变量在每次被线程访问时,都强迫从主内存中重读该成员变量的值.而且,当成员变量发生变化时,强迫线程将变化值回写到主内存.这样在任何时刻,两个不同的线程总是看到某个成员变量的同一 ...

  2. Using-jqGrid-s-search-toolbar-with-multiple-filter

    http://www.codeproject.com/Articles/58357/Using-jqGrid-s-search-toolbar-with-multiple-filter

  3. Java 第七天 动态代理

    代理类需实现InvocationHandler接口: public interface InvocationHandler { public Object invoke(Object proxy,Me ...

  4. STM32F0xx_RTC实时时钟配置详细过程

    Ⅰ.概述 今天总结RTC(Real Time Clock)实时时钟相关的知识,顺带将BKP简单总结一下. STM32的RTC模块和时钟配置系统(RCC_BDCR寄存器)处于后备区域,即在系统复位或从待 ...

  5. STM32F0xx_TIM基本延时配置详细过程

    前言 关于定时器大家都应该不会陌生,因为处理器都有这个功能.今天总结的F0系列芯片的定时器根据芯片型号不同,数量也不同.定时器分类:基本定时器.通用定时器和高级定时器.计数位数也有不同,有16位的,有 ...

  6. python 爬虫-sohu抓小说

    #coding:utf-8 import urllib2 import sys import re '): realurl = "%s%s%s" %(url,offset,'.sh ...

  7. Python学习教程(learning Python)--3.3.3 Python逻辑关系表达式

    在if分支判断语句里的条件判断语句不一定就是一个表达式,可以是多个(布尔)表达式的组合关系运算,这里如何使用更多的关系表达式构建出一个比较复杂的条件判断呢?这里需要再了解一下逻辑运算的基础知识.逻辑关 ...

  8. 有关GIT

    今天上班,发现没什么事情. 就看了一些博客,发现有个不错的东西,分享一下. 参考:http://www.liaoxuefeng.com/wiki/0013739516305929606dd183612 ...

  9. Android--PullToRefreshListView 的简单使用

    原文:  http://blog.csdn.net/lmj623565791/article/details/38238749; pull-to-refresh对ListView进行了封装,叫做:Pu ...

  10. HTTP上传文件探究

    通常情况下,我们想在网页上上传一个文件的时候,会采用<input type="file">标签,但是你有没有想过,为什么通过这样一个标签,服务器端就能获取到文件数据呢? ...