so文件相关
2018-08-31
今天尝试了一下编译so文件。
最开始是按照这个博主来操作的https://blog.csdn.net/tianshuai4317618/article/details/79073836
后来我的Android Studio (v3.1.3)说这种方式不再支持了,叫我换CMake。
然后我就换CMake了,可是一直报这个错
Build command failed.
Error while executing process D:\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HG:\AndroidStudioProjects\SoTest\app -BG:\AndroidStudioProjects\SoTest\app\.externalNativeBuild\cmake\debug\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-14 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=G:\AndroidStudioProjects\SoTest\app\build\intermediates\cmake\debug\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Debug -DANDROID_NDK=D:\sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=D:\sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=D:\sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}
CMake Error in CMakeLists.txt:
The CMAKE_C_COMPILER:
D:/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
is not a full path to an existing compiler tool.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
The CMAKE_CXX_COMPILER:
D:/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "G:/AndroidStudioProjects/SoTest/app/.externalNativeBuild/cmake/debug/armeabi-v7a/CMakeFiles/CMakeOutput.log".
Build command failed.
Error while executing process D:\sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {-HG:\AndroidStudioProjects\SoTest\app -BG:\AndroidStudioProjects\SoTest\app\.externalNativeBuild\cmake\release\armeabi-v7a -DANDROID_ABI=armeabi-v7a -DANDROID_PLATFORM=android-14 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=G:\AndroidStudioProjects\SoTest\app\build\intermediates\cmake\release\obj\armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DANDROID_NDK=D:\sdk\ndk-bundle -DCMAKE_CXX_FLAGS= -DCMAKE_TOOLCHAIN_FILE=D:\sdk\ndk-bundle\build\cmake\android.toolchain.cmake -DCMAKE_MAKE_PROGRAM=D:\sdk\cmake\3.6.4111459\bin\ninja.exe -GAndroid Gradle - Ninja}
CMake Error in CMakeLists.txt:
The CMAKE_C_COMPILER:
D:/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe
is not a full path to an existing compiler tool.
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
The CMAKE_CXX_COMPILER:
D:/sdk/ndk-bundle/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "G:/AndroidStudioProjects/SoTest/app/.externalNativeBuild/cmake/release/armeabi-v7a/CMakeFiles/CMakeOutput.log".
一直以为要配置什么变量,就去学CMakeLists.txt的语法,也没找到那个变量,不了了之了。
天无绝人之路,后来我碰运气,打到了解决办法
感谢博主https://blog.csdn.net/qq_36630050/article/details/80708685
我以前的ndk是17的,我按他说的改为ndk 16的就好了。
2018-09-19
今天打aar模块包的时候,不知道为什么,so文件没有打包进去,我是手动加进去的。好奇怪,导出aar没有包括so文件。
2019-04-22
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk I/art: Rejecting re-init on previously-failed class java.lang.Class<cn.angelshelter.app.apicloud.ffmpeg.link.FFmpegLink>
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: java.lang.reflect.InvocationTargetException
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at java.lang.reflect.Method.invoke(Native Method)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at java.lang.reflect.Method.invoke(Method.java:372)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at com.uzmap.pkg.uzcore.uzmodule.a$a.a(Unknown Source)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at com.uzmap.pkg.uzcore.uzmodule.a$1.run(Unknown Source)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at android.os.Handler.handleCallback(Handler.java:739)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at android.os.Looper.loop(Looper.java:135)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5569)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at java.lang.reflect.Method.invoke(Native Method)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at java.lang.reflect.Method.invoke(Method.java:372)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:931)
04-22 22:49:57.069 31357-31357/com.apicloud.pkg.sdk W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:726)
04-22 22:49:57.079 31357-31357/com.apicloud.pkg.sdk W/System.err: Caused by: java.lang.UnsatisfiedLinkError: cn.angelshelter.app.apicloud.ffmpeg.link.FFmpegLink
04-22 22:49:57.079 31357-31357/com.apicloud.pkg.sdk W/System.err: at cn.angelshelter.app.apicloud.ffmpeg.link.FFmpegLink.getInt(Native Method)
04-22 22:49:57.079 31357-31357/com.apicloud.pkg.sdk W/System.err: at cn.angelshelter.app.apicloud.ffmpeg.FFmpegModule.jsmethod_test(FFmpegModule.java:19)
04-22 22:49:57.079 31357-31357/com.apicloud.pkg.sdk W/System.err: ... 12 more
原因是我依赖了一个其它的第三方动态库so,但是我把那个so加进apk直接闪退,晕,如果把那个依赖库去掉就ok了。
2018-05-05
W/System.err: java.lang.reflect.InvocationTargetException
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
at com.uzmap.pkg.uzcore.uzmodule.a$a.a(Unknown Source)
at com.uzmap.pkg.uzcore.uzmodule.a$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6268)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:916)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:806)
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libavutil-55.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:989)
at java.lang.System.loadLibrary(System.java:1530)
at cn.angelshelter.app.apicloud.ffmpeg.link.FFmpegLink.<clinit>(FFmpegLink.java:23)
at cn.angelshelter.app.apicloud.ffmpeg.link.FFmpegLink.getInt(Native Method)
at cn.angelshelter.app.apicloud.ffmpeg.FFmpegModule.jsmethod_test(FFmpegModule.java:19)
... 10 more
用别人打好的so包。如果是
System.loadLibrary("swresample");//导入生成的链接库文件
System.loadLibrary("avcodec");//导入生成的链接库文件
System.loadLibrary("avutil");//导入生成的链接库文件
这样的顺序,就会报上面的错误 :
正确的写法是
System.loadLibrary("avutil");//导入生成的链接库文件
System.loadLibrary("swresample");//导入生成的链接库文件
System.loadLibrary("avcodec");//导入生成的链接库文件
。不过后来我自己打的包,却没这个限制。
2019-05-12
-- ::30.922 -/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.apicloud.pkg.sdk, PID:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.apicloud.pkg.sdk-1/base.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.apicloud.pkg.sdk-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.apicloud.pkg.sdk-/lib/arm64, /system/fake-libs64, /data/app/com.apicloud.pkg.sdk-/base.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_dependencies_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_0_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_1_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_2_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_3_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_4_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_5_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_6_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_7_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_8_apk.apk!/lib/arm64-v8a, /data/app/com.apicloud.pkg.sdk-/split_lib_slice_9_apk.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]] couldn't find "libsec.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:)
at java.lang.System.loadLibrary(System.java:)
at com.uzmap.pkg.uzcore.external.Enslecb.<clinit>(Unknown Source)
at com.uzmap.pkg.uzcore.external.Enslecb.xsm(Unknown Source)
at com.uzmap.pkg.uzcore.external.g.b(Unknown Source)
at com.uzmap.pkg.uzcore.t.a(Unknown Source)
at com.uzmap.pkg.uzapp.UZApplication.onCreate(Unknown Source)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:)
at android.os.Handler.dispatchMessage(Handler.java:)
at android.os.Looper.loop(Looper.java:)
at android.app.ActivityThread.main(ActivityThread.java:)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:)
这个是我启用了ndk编译后,没有找到对应的架包造成的,就是ndk打出来的是全平台的,而第三方SDK只是指定平台的。所以要在build.gradle加上
android{
defaultConfig {
ndk{
abiFilters "armeabi"
}
}
}
指定只打包armeabi平台的。
如果加了还是会有,“就清缓存” 。build\intermediates\cmake,这里面的删除了。我的就是多了一个arm64-v8a平台。
so文件相关的更多相关文章
- Android根据文件路径使用File类获取文件相关信息
Android通过文件路径如何得到文件相关信息,如 文件名称,文件大小,创建时间,文件的相对路径,文件的绝对路径等: 如图: 代码: public class MainActivity extends ...
- [ARM] Cortex-M Startup.s启动文件相关代码解释
1. 定义一个段名为CSTACK, 这里: NOROOT表示如何定义的段没有被关联,那么同意会被优化掉,如果不想被优化掉就使用ROOT. 后面的括号里数字表示如下: (1):这个段是2的1次方即2字节 ...
- 文件相关操作工具类——FileUtils.java
文件相关操作的工具类,创建文件.删除文件.删除目录.复制.移动文件.获取文件路径.获取目录下文件个数等,满足大多数系统需求. 源码如下:(点击下载 FileUtils.java) import jav ...
- python 文件相关知识
字符编码相关 什么是字符编码 字符编码的类型 字符编码的使用 python2和python里字符编码的区别 文件的相关 文件的基础操作 打开文件的模式 字符编码 什么是字符编码在计算机里只识别二进制, ...
- python Tags 母板 组件 静态文件相关 自定义simpletag inclusion_tag
一.Tags(一)for 1.基本用法 <ul> {% for user in user_list %} <li>{{ user.name }}</li> {% e ...
- Head First Python-Python中与文件相关的操作-读、处理、写
最近在看head first python,前面也写了一些笔记,但是基本上没有涉及到一些完整的代码,现在将书中的文件相关操作的代码整理,供以后参考. 主要分为两大部分,读取文件.处理异常,处理文件.存 ...
- Git基本命令 -- 基本工作流程 + 文件相关操作
可以先找一个已经被git管理的项目, 我就使用这个项目吧: https://github.com/solenovex/ID3-Editor 基本工作流程 克隆以后呢, 进入该目录查看一下状态: 然后添 ...
- linux 命令 — 文件相关
使用文件相关命令 dd 用来生成任意大小的文件 dd if=/dev/zero of=junk.data bs=1m count=1 生成一个1m大小的文件,里面全部使用0填充 if: 指定输入文件, ...
- python全栈开发day65-templates:tags、母版和继承、组件、静态文件相关、simple_tag和inclusion_tag
一.昨日内容回顾 1.MVC和MTV框架 MVC: model 模型 存写数据 view 视图 给用户展示页面 control 控制器 负责调度 传递指令 MTV: M:model 模型 OR ...
- 006.ks.cfg文件相关
一 图形化生成ks.cfg文件 [root@server ~]# yum -y install system-config-kickstart #安装图形化kickstart工具 [root@serv ...
随机推荐
- Global Illumination
[Global Illumination] Global Illumination (GI) is a system that models how light is bounced off of s ...
- angular记录
1. <h1>{{title}}</h1> 双花括号语法是 Angular 的插值绑定语法. 这个插值绑定的意思是把组件的 title 属性的值绑定到 HTML 中的 h1 标 ...
- javascript学习笔记(七):事件详解
HTML事件处理 <!DOCTYPE html> <html> <head lang="en"> <meta chaset="U ...
- Shell教程 之流程控制
1. if else 1.1 if if语句语法格式: if condition then command1 command2 ... commandN fi 写成一行(适用于终端命令提示符): if ...
- selector 选择器
布局文件中: <ImageView android:id="@+id/image_message" android:layout_width="40dp" ...
- Mastering Unity 2D Game Development
Mastering Unity 2D Game Development will give your game development skills a boost and help you begi ...
- 100-days: eight
Title: U.S.(美国司法部) accuses rich parents of college entry fraud accuse v.指控,指责,谴责 accuse someone of ...
- 关于json.stringify的注意事项
今天通过navigator.getCurrentPosition中的success回调,用json.stringify打印postion时,怎么打印都只是一个{}, 而打印postion.coords ...
- Win7 IIS 配置错误:不能在此路径中使用此配置节。如果在父级别上锁定了该节,便会出现这种情况。锁定是默认设置的
因为 IIS 7 采用了更安全的 web.config 管理机制,默认情况下会锁住配置项不允许更改.运行命令行 %windir%\system32\inetsrv\appcmd unlock conf ...
- [leetcode]692. Top K Frequent Words K个最常见单词
Given a non-empty list of words, return the k most frequent elements. Your answer should be sorted b ...