文章目录
- 一、报错信息
- 二、解决方案
- 方案一
- 方案二
一、报错信息
在 Android 应用中 , 使用 ijkplayer , 如果在 build.gradle 中配置了 abiFilters 如下架构
代码语言:javascript复制android {
defaultConfig {
ndk {
abiFilters "armeabi-v7a", "arm64-v8a"
}
}
}
打包 so 动态库时 , 就会打包 “armeabi-v7a”, “arm64-v8a” 这两个架构的动态库 ,
参考 【错误记录】Android 应用执行报错 ( java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader) 博客 ,
如果要导入 arm64 架构的动态库 , 则需要导入
代码语言:javascript复制implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'
动态库 , 则报如下错误 :
代码语言:javascript复制> Task :APP_MIDI:processDebugMainManifest FAILED
[com.android.support:animated-vector-drawable:28.0.0] C:Usersoctop.gradlecachestransforms-2files-2.13834af447b012165d7b2b5f1ce55daf8animated-vector-drawable-28.0.0AndroidManifest.xml Warning:
Package name 'android.support.graphics.drawable' used in: com.android.support:animated-vector-drawable:28.0.0, com.android.support:support-vector-drawable:28.0.0.
Y: 02_WorkSpace 00_Android_WorkMIDI_TV_GooglePlay_100M_APKMIDI_TVAPP_MIDIsrcmainAndroidManifest.xml Error:
uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8] C:Usersoctop.gradlecachestransforms-2files-2.13fe1eab93e41ce9151c23d920db28b32ijkplayer-arm64-0.8.8AndroidManifest.xml as the library might be using APIs not available in 19
Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="tv.danmaku.ijk.media.player_arm64" to force usage (may lead to runtime failures)
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
> Task :APP_MIDI:checkDebugAarMetadata
二、解决方案
在报错中 , 给出了 2 种修改方案 :
代码语言:javascript复制 Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="tv.danmaku.ijk.media.player_arm64" to force usage (may lead to runtime failures)
方案一
在 build.gradle 中配置 android # defaultConfig # minSdkVersion 为 21 ;
代码语言:javascript复制android {
compileSdkVersion 30
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.app"
minSdkVersion 19
}
}
方案二
在 AndroidManifest.xml 中 , 配置
代码语言:javascript复制 <uses-sdk
xmlns:tools="http://schemas.android.com/tools"
tools:overrideLibrary="tv.danmaku.ijk.media.player_arm64"/>
标签 , 配置位置在 manifest 跟标签下 , 与 application 标签平级 ;
代码语言:javascript复制<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.app"
android:installLocation="auto">
<uses-sdk
xmlns:tools="http://schemas.android.com/tools"
tools:overrideLibrary="tv.danmaku.ijk.media.player_arm64"/>
</manifest>