Android java.lang.UnsatisfiedLinkError couldn't find libijkffmpeg.so完美解决

本文主要是介绍Android java.lang.UnsatisfiedLinkError couldn't find libijkffmpeg.so完美解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

播放视频报错:

 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.hjq.demo-2/base.apk"],nativeLibraryDirectories=[/data/app/com.hjq.demo-2/lib/arm64, /data/app/com.hjq.demo-2/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libijkffmpeg.so"

解决方法:

其实就是项目里没有发现需要的.so库,你让你的项目中有相应的.so库即可。

1.在app的build.gradle中配置ndk:

 // 仅保留两种架构的 so 库ndk {// armeabi:已经淘汰(0%)// armeabi-v7a:曾经主流的架构平台(20%)// arm64-v8a:目前主流架构平台(80%)//"x86_64",abiFilters "armeabi-v7a", "arm64-v8a", "x86", "armeabi"}

或者:

splits {abi {enable truereset()include 'x86', 'x86_64', 'armeabi-v7a', 'armeabi'universalApk false}
}

贴出全部的build.gradle 供大家参考:

apply plugin: 'com.android.application'android {compileSdkVersion rootProject.ext.compileVersion// 使用 JDK 1.8compileOptions {targetCompatibility JavaVersion.VERSION_1_8sourceCompatibility JavaVersion.VERSION_1_8}lintOptions {abortOnError false}defaultConfig {// 无痛修改包名:https://www.jianshu.com/p/17327e191d2eapplicationId "com.hjq.demo"minSdkVersion 16targetSdkVersion rootProject.ext.targetVersionversionCode 10versionName "1.0"testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"// 仅保留中文语种的资源resConfig 'zh'// 仅保留 xxhdpi 图片资源(目前主流分辨率 1920 * 1080)resConfig 'xxhdpi'// 仅保留两种架构的 so 库ndk {// armeabi:已经淘汰(0%)// armeabi-v7a:曾经主流的架构平台(20%)// arm64-v8a:目前主流架构平台(80%)//"x86_64",abiFilters "armeabi-v7a", "arm64-v8a", "x86", "armeabi"}// 开启 Dex 分包//multiDexEnabled true// 混淆配置proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-app.pro'javaCompileOptions {annotationProcessorOptions {// EventBus Apt 索引类生成位置arguments = [ eventBusIndex : applicationId + '.MyEventBusIndex' ]}}}// APK 签名的那些事:https://www.jianshu.com/p/a1f8e5896aa2signingConfigs {debug {storeFile file(StoreFile)storePassword StorePasswordkeyAlias KeyAliaskeyPassword KeyPassword}release {storeFile file(StoreFile)storePassword StorePasswordkeyAlias KeyAliaskeyPassword KeyPassword}}buildTypes {release {// 移除无用的资源文件shrinkResources true// ZipAlign 优化zipAlignEnabled true// 设置混淆minifyEnabled true// 正式环境签名signingConfig signingConfigs.release// 正式环境下的 BuglyIdbuildConfigField "String", "BUGLY_ID", "\"请自行替换 Bugly 上面的 AppID\""}debug {// 移除无用的资源文件shrinkResources false// ZipAlign 优化zipAlignEnabled false// 设置混淆minifyEnabled false// 开发环境签名signingConfig signingConfigs.debug// 开发环境下的 BuglyIdbuildConfigField "String", "BUGLY_ID", "\"请自行替换 Bugly 上面的 AppID\""}}// 默认渠道名flavorDimensions "default"// 友盟多渠道打包productFlavors {tencent {}  // 应用宝baidu {}    // 百度xiaomi {}   // 小米huawei {}   // 华为productFlavors.all { flavor ->flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]}}// JNI 目录sourceSets {main {jniLibs.srcDirs = ['libs']}}// 执行配置applicationVariants.all { variant ->// Apk 输出配置variant.outputs.all { output ->def appName = "AndroidProject"if (variant.buildType.name == 'debug') {outputFileName = appName + '_v' + versionName + '_' + variant.buildType.name + '.apk'} else {outputFileName = appName + '_v' + versionName + '_' + new Date().format("yyyyMMdd") + '_' + variant.productFlavors[0].name + '_' + variant.buildType.name + '.apk'}}// AndroidManifest 输出配置variant.outputs[0].processManifest.doLast {def manifestFile = "${manifestOutputDirectory}/AndroidManifest.xml"def updatedContent = new File(manifestFile).getText('UTF-8').replaceAll("UMENG_APPKEY_VALUE", "5cb16d93570df399fd0014e2") // 友盟 AppKey.replaceAll("QQ_APPID_VALUE", "100424468") // QQ AppId.replaceAll("QQ_APPKEY_VALUE", "c7394704798a158208a74ab60104f0ba") // QQ Key.replaceAll("WX_APPID_VALUE", "wxdc1e388c3822c80b") // 微信 AppId.replaceAll("WX_APPKEY_VALUE", "3baf1193c85774b3fd9d18447d76cab0") // 微信 Keynew File(manifestFile).write(updatedContent, 'UTF-8')}}
}// api 与 implementation 的区别:https://www.jianshu.com/p/8962d6ba936e
dependencies {// 依赖 libs 目录下所有 jar 包implementation fileTree(include: ['*.jar'], dir: 'libs')// 依赖 libs 目录下所有 aar 包implementation fileTree(include: ['*.aar'], dir: 'libs')// 基础库(不包任何第三方框架)implementation project(':base')// 自定义 Viewimplementation project(':widget')// Glide 隔离implementation project(':image')// 友盟隔离implementation project(':umeng')// 谷歌 Support 包implementation "androidx.appcompat:appcompat:$rootProject.ext.appcompatVersion"implementation "com.google.android.material:material:$rootProject.ext.materialVersion"// Dex 分包,解决 64k 方法问题//implementation 'androidx.multidex:multidex:2.0.1'// ButterKnife 注解库:https://github.com/JakeWharton/butterknifeimplementation 'com.jakewharton:butterknife:10.1.0'annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'// EventBus 事件总线:https://github.com/greenrobot/EventBusimplementation "org.greenrobot:eventbus:3.1.1"annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.1.1'// 状态栏沉浸:https://github.com/gyf-dev/ImmersionBarimplementation 'com.gyf.immersionbar:immersionbar:3.0.0'// 权限请求框架:https://github.com/getActivity/XXPermissionsimplementation 'com.hjq:xxpermissions:6.0'// 标题栏:https://github.com/getActivity/TitleBarimplementation 'com.hjq:titlebar:6.0'// 吐司工具类:https://github.com/getActivity/ToastUtilsimplementation 'com.hjq:toast:8.0'// 支持放大缩放的 ImageView:https://github.com/chrisbanes/PhotoViewimplementation 'com.github.chrisbanes:PhotoView:2.3.0'// ViewPager 指示器:https://github.com/romandanylyk/PageIndicatorViewimplementation 'com.romandanylyk:pageindicatorview:1.0.3'// Bugly 异常捕捉:https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=20190418140644implementation 'com.tencent.bugly:crashreport:3.0.1'implementation 'com.tencent.bugly:nativecrashreport:3.7.1'// 本地异常捕捉框架:https://github.com/Ereza/CustomActivityOnCrashimplementation 'cat.ereza:customactivityoncrash:2.2.0'// 内存泄漏捕捉:https://github.com/square/leakcanarydebugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'// 网络请求(待发布):https://github.com/getActivity/EasyHttp// 国际化:https://github.com/getActivity/MultiLanguages// 悬浮窗:https://github.com/getActivity/XToast// 上拉刷新下拉加载:https://github.com/scwang90/SmartRefreshLayout// 工具类:https://github.com/Blankj/AndroidUtilCode// 轮播图:https://github.com/bingoogolapple/BGABanner-Android// 二维码:https://github.com/bingoogolapple/BGAQRCode-Android// 第三方支付:https://github.com/getActivity/RxPay// Log 打印:https://github.com/elvishew/XLog// 图片压缩:https://github.com/Curzibn/Luban// 对象存储:https://github.com/leavesC/DoKV// 数据注入:https://github.com/JumeiRdGroup/Parcelerimplementation 'com.android.support:design:26.1.0'//约束布局implementation 'com.android.support.constraint:constraint-layout:1.0.2'//第三方适配器implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'implementation 'com.google.code.gson:gson:2.8.0'
//    implementation 'com.github.bumptech.glide:glide:3.7.0'//通用标题栏implementation 'com.hjq:titlebar:6.0'implementation 'com.makeramen:roundedimageview:2.3.0'//高度自定义的开源安卓视频框架implementation 'cn.jzvd:jiaozivideoplayer:7.0.5'implementation 'com.danikula:videocache:2.7.0'
//    implementation 'com.github.bumptech.glide:glide:4.7.1'implementation 'com.github.bumptech.glide:glide:4.9.0'dependencies {implementation ('com.google.android.exoplayer:exoplayer:2.9.1'){}}
//    dependencies {
//        implementation ('com.github.bumptech.glide:glide:4.7.1'){
//
//        }
//    }implementation 'tv.danmaku.ijk.media:ijkplayer-java:0.8.8'implementation 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.4'
//    implementation 'com.google.android.exoplayer:exoplayer:2.9.1'}

然后同步一下就可以了,若是还是这个错误的话,看下面。

2.配置ndk没有一点反应,依旧还是这个错误,就要需要下载.so库了(错误提示没有发现哪个.so库就下载哪个.so)

这里提供.so的下载地址:libijkffmpeg.so或者加我QQ1223235200直接QQ传.so库

 

相关视频框架播放: 

Android VideoPlayer MediaPlayer VideoView MediaView Float View And Fullscreen.高度自定义的开源安卓视频框架

https://github.com/lipangit/JiaoZiVideoPlayer

https://github.com/lurenman/JiaoZiVideoPlayerDemo

https://github.com/Life1412378121/TVPlayer-IPTV-EasyPlayer

https://github.com/CarGuo/GSYVideoPlayer

https://github.com/curtis2/SuperVideoPlayer

https://github.com/w1123440793/VideoListDemo

https://github.com/ashqal/MD360Player4Android

https://github.com/hejunlin2013/DragVideo

https://github.com/Zhaoss/VideoPlayerDemo

 

这篇关于Android java.lang.UnsatisfiedLinkError couldn't find libijkffmpeg.so完美解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:https://blog.csdn.net/shenggaofei/article/details/102822829
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/590592

相关文章

Java获取当前时间String类型和Date类型方式

《Java获取当前时间String类型和Date类型方式》:本文主要介绍Java获取当前时间String类型和Date类型方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,... 目录Java获取当前时间String和Date类型String类型和Date类型输出结果总结Java获取

Spring Boot Actuator应用监控与管理的详细步骤

《SpringBootActuator应用监控与管理的详细步骤》SpringBootActuator是SpringBoot的监控工具,提供健康检查、性能指标、日志管理等核心功能,支持自定义和扩展端... 目录一、 Spring Boot Actuator 概述二、 集成 Spring Boot Actuat

OpenCV在Java中的完整集成指南分享

《OpenCV在Java中的完整集成指南分享》本文详解了在Java中集成OpenCV的方法,涵盖jar包导入、dll配置、JNI路径设置及跨平台兼容性处理,提供了图像处理、特征检测、实时视频分析等应用... 目录1. OpenCV简介与应用领域1.1 OpenCV的诞生与发展1.2 OpenCV的应用领域2

在Java中使用OpenCV实践

《在Java中使用OpenCV实践》用户分享了在Java项目中集成OpenCV4.10.0的实践经验,涵盖库简介、Windows安装、依赖配置及灰度图测试,强调其在图像处理领域的多功能性,并计划后续探... 目录前言一 、OpenCV1.简介2.下载与安装3.目录说明二、在Java项目中使用三 、测试1.测

Spring Bean初始化及@PostConstruc执行顺序示例详解

《SpringBean初始化及@PostConstruc执行顺序示例详解》本文给大家介绍SpringBean初始化及@PostConstruc执行顺序,本文通过实例代码给大家介绍的非常详细,对大家的... 目录1. Bean初始化执行顺序2. 成员变量初始化顺序2.1 普通Java类(非Spring环境)(

Spring Boot 中的默认异常处理机制及执行流程

《SpringBoot中的默认异常处理机制及执行流程》SpringBoot内置BasicErrorController,自动处理异常并生成HTML/JSON响应,支持自定义错误路径、配置及扩展,如... 目录Spring Boot 异常处理机制详解默认错误页面功能自动异常转换机制错误属性配置选项默认错误处理

java如何实现高并发场景下三级缓存的数据一致性

《java如何实现高并发场景下三级缓存的数据一致性》这篇文章主要为大家详细介绍了java如何实现高并发场景下三级缓存的数据一致性,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 下面代码是一个使用Java和Redisson实现的三级缓存服务,主要功能包括:1.缓存结构:本地缓存:使

Java Spring的依赖注入理解及@Autowired用法示例详解

《JavaSpring的依赖注入理解及@Autowired用法示例详解》文章介绍了Spring依赖注入(DI)的概念、三种实现方式(构造器、Setter、字段注入),区分了@Autowired(注入... 目录一、什么是依赖注入(DI)?1. 定义2. 举个例子二、依赖注入的几种方式1. 构造器注入(Con

SpringBoot 异常处理/自定义格式校验的问题实例详解

《SpringBoot异常处理/自定义格式校验的问题实例详解》文章探讨SpringBoot中自定义注解校验问题,区分参数级与类级约束触发的异常类型,建议通过@RestControllerAdvice... 目录1. 问题简要描述2. 异常触发1) 参数级别约束2) 类级别约束3. 异常处理1) 字段级别约束

如何在Java Spring实现异步执行(详细篇)

《如何在JavaSpring实现异步执行(详细篇)》Spring框架通过@Async、Executor等实现异步执行,提升系统性能与响应速度,支持自定义线程池管理并发,本文给大家介绍如何在Sprin... 目录前言1. 使用 @Async 实现异步执行1.1 启用异步执行支持1.2 创建异步方法1.3 调用