一、错误记录
编译运行 ijkplayer 源码 , 报如下错误 , 源码比较老旧 , 2018 年的源码 ;
在 Ubuntu 中编译完毕后 , 在 Windows 中使用 Android Studio 运行该源码 ;
报错信息 :
代码语言:javascript复制All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html
Affected Modules: ijkplayer-example
Configuration 'all64Compile' is obsolete and has been replaced with 'all64Implementation' and 'all64Api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: ijkplayer-example
Configuration 'all32Compile' is obsolete and has been replaced with 'all32Implementation' and 'all32Api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: ijkplayer-example
二、解决方案
先简单翻译一下 :
所有 Flavor 现在都必须属于一个命名的 Flavor 维度。更多信息请访问https://d.android.com/r/tools/flavorDimensions-missing-error-message.html 受影响模块:ijkplayer-example
配置’all64Compile’已过时,已被’all64Implementation’和’all64Api’取代。 它将在2018年底被移除。欲了解更多信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html 受影响模块:ijkplayer-example
配置’all32Compile’已过时,并已被’all32Implementation’和’all32Api’所取代。 它将在2018年底被移除。欲了解更多信息,请参阅:http://d.android.com/r/tools/update-dependency-configurations.html 受影响模块:ijkplayer-example
在 productFlavors 上方添加 flavorDimensions “minSdkVersion” , 指定设置的纬度为 最小 SDK 版本号 ;
代码语言:javascript复制android {
flavorDimensions "minSdkVersion"
productFlavors {
all32 { minSdkVersion 21 }
all64 { minSdkVersion 21 }
// armv5 {}
// armv7a {}
// arm64 { minSdkVersion 21 }
// x86 {}
}
}
将所有的依赖设置为 : 由 compile 依赖 改为 implementation 依赖 ;
代码语言:javascript复制dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:23.0.1'
implementation 'com.android.support:preference-v7:23.0.1'
implementation 'com.android.support:support-annotations:23.0.1'
implementation 'com.squareup:otto:1.3.8'
implementation project(':ijkplayer-java')
implementation project(':ijkplayer-exo')
implementation project(':ijkplayer-armv5')
implementation project(':ijkplayer-armv7a')
implementation project(':ijkplayer-x86')
implementation project(':ijkplayer-armv5')
implementation project(':ijkplayer-armv7a')
implementation project(':ijkplayer-arm64')
implementation project(':ijkplayer-x86')
implementation project(':ijkplayer-x86_64')
}