
android在用System.load()加载so文件时出现已经加载到内存错误,如何解决? 10
在做android插件开发时候,因为插件中有c++代码,需要用System.load("libhello.so"),我把加载so的方法放在static块中。第一次启动这个...
在做android插件开发时候,因为插件中有c++代码,需要用System.load("libhello.so"),我把加载so的方法放在static块中。第一次启动这个类时还没有问题,但是退出之后马上就启动那个类就会出现错误,如下:12-25 16:43:25.970: D/dalvikvm(26460): Trying to load lib /data/data/com.demo.app/lib/libHello.so 0x40e86a2812-25 16:43:25.970: W/dalvikvm(26460): Shared lib '/data/data/com.demo.app/lib/libHello.so' already opened by CL 0x40e65a78; can't open in 0x40e86a28这个需要怎样解决?在线等
展开
展开全部
这要看你在c++代码里有没有没释放的内存了。毕竟能成功运行一次,说明编译没错误,配置也没错误。看检察一下你的c++代码。
展开全部
/**
* Loads and links the dynamic library that is identified through the
* specified path. This method is similar to {@link #loadLibrary(String)},
* but it accepts a full path specification whereas {@code loadLibrary} just
* accepts the name of the library to load.
*
* @param pathName
* the path of the file to be loaded.
*/
public static void load(String pathName) {
Runtime.getRuntime().load(pathName, VMStack.getCallingClassLoader());
}
加载的是specified path,是路径,不是单纯的文件。
文件的话可以尝试System.loadLibrary
* Loads and links the dynamic library that is identified through the
* specified path. This method is similar to {@link #loadLibrary(String)},
* but it accepts a full path specification whereas {@code loadLibrary} just
* accepts the name of the library to load.
*
* @param pathName
* the path of the file to be loaded.
*/
public static void load(String pathName) {
Runtime.getRuntime().load(pathName, VMStack.getCallingClassLoader());
}
加载的是specified path,是路径,不是单纯的文件。
文件的话可以尝试System.loadLibrary
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
根你I一起等
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询