简体   繁体   English

在Android上使用System.load?

[英]Use System.load on Android?

I'm trying to load a library in Android from its internal storage (I'm having the user download it externally, so as to reduce the apk size) 我正在尝试从其内部存储中加载Android库(我正在让用户从外部下载该库,以减小apk大小)

But whenever I execute System.load() in the activity, I get these errors: 但是,每当我在活动中执行System.load()时,都会出现以下错误:

Localized Message: dlopen failed: couldn't map "/storage/emulated/0/libtest.so" segment 2: Permission denied
Message: dlopen failed: couldn't map "/storage/emulated/0/libtest.so" segment 2: Permission denied

I also tried copying the .so file to /data/local/tmp and loading it from there, but was presented with the same error. 我还尝试将.so文件复制到/ data / local / tmp并从那里加载它,但是出现了同样的错误。

Is there any workaround around this? 有什么解决方法吗?

您定位到哪个API级别?对于API级别> = 23,您需要提供动态运行时权限。

我看到权限被拒绝,您可以尝试将文件权限设置为777

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

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