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. mysql查询语句(mysql学习笔记七)

    Sql语句 一般顺序GHOL : group by,having ,order by,limit     如果是分组,应该使用对分组字段进行排序的group by语法                 ...

  2. php验证手机号码

    大家都应该有这个常识,中国的手机号码都是以数字“1”开头,然后利用“0~9”10个数字组成的11位数字组合,那么我们的验证规则肯定要根据这个思路来写. 根据上面的简单思路,我们便可以写下以下的验证代码 ...

  3. 怎样使android的view动画循环弹动

    在res中建立文件夹anim,分别写下cycles.xml,shake1.xml,shake2.xml cycles.xml: <?xml version="1.0" enc ...

  4. 数组(Array),二维数组,三维数组

    数组(Array):相同类型数据的集合就叫做数组. (一)定义数组的方法: A) type[] 变量名 = new type[数组中元素的个数] 例如: int[] a = new int[10] ; ...

  5. EMVTag系列2《磁条等效数据》

    Ø 57  磁条2等效数据 L: var. up to 19 -M(必备):此数据必须存在并提供给终端,终端在读应用数据过程中,如果没有读到必备数据,终端中止交易 按GB/T 17552,磁条2的数据 ...

  6. Java生成唯一的ID

    public class UIDGenerator { private static Date date = new Date(); private static StringBuilder buf ...

  7. malloc calloc realloc,new区别联系以及什么时候用

    三个函数的申明分别是:void* realloc(void* ptr, unsigned newsize);void* malloc(unsigned size);void* calloc(size_ ...

  8. viewPager+Handler+Timer简单实现广告轮播效果

    基本思想是在Avtivity中放一个ViewPager,然后通过监听去实现联动效果,代码理由详细的解释,我就不说了. MainActivity.java package com.example.adm ...

  9. MyEclipse查看Struts2源码及Javadoc文档

    一.查看Struts2源码 1.Referenced Libraries >struts2-core-2.1.6.jar>右击>properties. 2.Java Source A ...

  10. java数据结构和算法------顺序查找

    package iYou.neugle.search; public class Sequence_search { public static int SequenceSearch(double[] ...