简体   繁体   English

如何将本机库加载到android库项目

[英]How to load native library to android library project

First, my project structure is like this: 首先,我的项目结构是这样的:

Android project A --> Android Library project B(contains some native so library) --> Java library C . Android项目A-> Android库项目B(包含一些本机so库)-> Java库C。

  1. how the project A reference the android library project B: 项目A如何引用android库项目B: 在此处输入图片说明

  2. The native library in the android library project B. android库项目B中的本机库。

在此处输入图片说明

  1. how the Android Library project B is library: Android库项目B如何是库: 在此处输入图片说明

  2. The load library code (in the android library project B) : 加载库代码(在android库项目B中):

    System.loadLibrary("G72x"); System.loadLibrary(“ G72x”);

    System.loadLibrary("H264Android"); System.loadLibrary(“ H264Android”);

  3. The crash log : 崩溃日志:

     12-27 20:32:51.698: E/AndroidRuntime(11589): FATAL EXCEPTION: Thread-1694 12-27 20:32:51.698: E/AndroidRuntime(11589): java.lang.UnsatisfiedLinkError: InitDecoder 12-27 20:32:51.698: E/AndroidRuntime(11589): at com.xx.xxx.media.H264Decoder.InitDecoder(Native Method) 12-27 20:32:51.698: E/AndroidRuntime(11589): at com.xx.xxx.media.VideoParseThread.getH264(VideoParseThread.java:131) 12-27 20:32:51.698: E/AndroidRuntime(11589): at com.xxx.xxx.media.VideoParseThread.run(VideoParseThread.java:46) 

Now when the application run the code that need the so library, it crashed. 现在,当应用程序运行需要so库的代码时,它崩溃了。 I have read some answers, but it's still not resolved. 我已经阅读了一些答案,但仍未解决。

If the all the library b project is in the project A, it worked well. 如果所有库b项目都在项目A中,则它运行良好。

Any help will be appreciated, this problem drives me crazy, i know it should have one solution, but i don't know how. 任何帮助将不胜感激,这个问题使我发疯,我知道它应该有一个解决方案,但我不知道如何。

First: 第一:
Horrible explaination of your project and description of your project structure. 您的项目的可怕解释和项目结构的描述。
Second: 第二:
Make sure it is exported in your build settings. 确保将其导出到您的构建设置中。
If you explain more precise, how your structure is, maybe with Screenshots, then I can narrow down my explanation of your mistake 如果你能解释一下更精确,你的结构如何,可能与屏幕截图,然后我可以缩小我的你的错误的解释

Edit: 编辑:

Under your "project properties" go into "java build path" and then "order and export". 在“项目属性”下,进入“ java构建路径”,然后进入“订购并导出”。
In here your project needs to be present and marked. 在这里,您的项目需要存在并标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM