错误记录Android 应用导入 ijkplayer 报错 ( uses-sdk:minSdkVersion 19 cannot be smaller than version 21 decl )

Posted 韩曙亮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误记录Android 应用导入 ijkplayer 报错 ( uses-sdk:minSdkVersion 19 cannot be smaller than version 21 decl )相关的知识,希望对你有一定的参考价值。

文章目录





一、报错信息



android 应用中 , 使用 ijkplayer , 如果在 build.gradle 中配置了 abiFilters 如下架构

android 
    defaultConfig 
        ndk 
            abiFilters "armeabi-v7a", "arm64-v8a" 
        
	

打包 so 动态库时 , 就会打包 “armeabi-v7a”, “arm64-v8a” 这两个架构的动态库 ,

参考 【错误记录】Android 应用执行报错 ( java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader) 博客 ,

如果要导入 arm64 架构的动态库 , 则需要导入

implementation 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.8'

动态库 , 则报如下错误 :

> Task :APP_MIDI:processDebugMainManifest FAILED
[com.android.support:animated-vector-drawable:28.0.0] C:\\Users\\octop\\.gradle\\caches\\transforms-2\\files-2.1\\3834af447b012165d7b2b5f1ce55daf8\\animated-vector-drawable-28.0.0\\AndroidManifest.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:\\002_WorkSpace\\000_Android_Work\\MIDI_TV_GooglePlay_100M_APK\\MIDI_TV\\APP_MIDI\\src\\main\\AndroidManifest.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:\\Users\\octop\\.gradle\\caches\\transforms-2\\files-2.1\\3fe1eab93e41ce9151c23d920db28b32\\ijkplayer-arm64-0.8.8\\AndroidManifest.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 2 2 种修改方案 :

	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 21 21 ;

android 
    compileSdkVersion 30
    buildToolsVersion "29.0.2"

    defaultConfig 
        applicationId "com.example.app"
        minSdkVersion 19
    

方案二

在 AndroidManifest.xml 中 , 配置

    <uses-sdk
        xmlns:tools="http://schemas.android.com/tools"
        tools:overrideLibrary="tv.danmaku.ijk.media.player_arm64"/>

标签 , 配置位置在 manifest 跟标签下 , 与 application 标签平级 ;

<?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>

以上是关于错误记录Android 应用导入 ijkplayer 报错 ( uses-sdk:minSdkVersion 19 cannot be smaller than version 21 decl )的主要内容,如果未能解决你的问题,请参考以下文章

错误记录编译 Android 版本的 ijkplayer 报错 ( ./init-android.sh: 第 37 行: cd: android/contrib/: 没有那个文件或目录 )

ijkplayer如何导入android studio

错误记录编译 ijkplayer 报错 (fatal error: ijksoundtouch/ijksoundtouch_wrap.h: No such file or directory )

错误记录编译 ijkplayer 报错 (fatal error: libyuv.h: No such file or directory #include “libyuv.h“ )

错误记录Android 应用执行报错 ( java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[ )

Android ijkplayer详解使用教程