我正在使用
com.amazon.android:exoplayer-ui:r2.5.4
在我的项目中,我只是将IDE升级到Android Studio 3.3.1。 在我的build.gradle
中,我有以下编译的代码
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
在尝试构建时,我会收到此错误:
任务:app:mergeextdexdebug失败的agpbi: {" ank":" error"," text":"仅支持默认接口方法 从Android N( - Min-API 24)开始:空隙 com.google.android.exoplayer2.player $ eventListener.onloadingChanged(boolean)"," sources":[{}],"工具":" D8"}
失败:构建失败而异常。
- 出了什么问题:无法解析配置的所有文件':app:debugruntimeclasspath'。 无法将文件" class.jar"转换为匹配属性{artifactType = android-dex,dexing-is-debuggable = true, 使用transform dexingtransform dexing-min-sdk = 21} 触点时错误。
当我将sourceCompatibility
和targetCompatibility
更改为JavaVersion.VERSION_1_8
时,它将成功构建,但是应用程序崩溃了以下错误:
e/androidruntime:致命例外:主要 过程:com.mypackage,pid:4374 java.lang.nosuchmethoderror:无直接方法(lcom/google/google/android/exoplayer2/upstream/defaultallocator; iijjlcom/google/google/android/exoplayer/exoplayer2/utitial/prioritytaskmanager;)v 在类lcom/google/android/exoplayer2/defaultloadControl中;或它的 超级课(声明 'com.google.android.exoplayer2.defaultloadControl'出现在 /data/app/mypackagename/base.apk:classes5.dex)
有什么建议?
项目build.gradle
buildscript {
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories {
jcenter()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://maven.google.com' }
google()
}
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:3.3.1'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
应用程序build.gradle
buildscript {
repositories {
google()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.27.0'
classpath 'com.google.gms:google-services:4.2.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
applicationId ‘myAppId’
minSdkVersion 21
targetSdkVersion 26
versionCode 31
versionName "1.3.5"
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation":
"$projectDir/schemas".toString()]
}
}
sourceSets {
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}
}
dexOptions {
javaMaxHeapSize "6g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/android.arch.lifecycle_runtime.version'
}
}
dependencies {
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:leanback-v17:23.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.google.code.gson:gson:2.2.4'
implementation 'com.google.android.gms:play-services-ads:9.8.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.jakewharton:butterknife:7.0.1'
implementation 'com.makeramen:roundedimageview:2.2.1'
implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.android.support:animated-vector-drawable:26.1.0'
implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.8.5'
implementation('com.amazon.android:exoplayer-ui:r2.5.4') {
exclude module: 'exoplayer-core'
}
api 'com.amazon.android:exoplayer-core:r2.5.4'
implementation 'com.amazon.android:exoplayer-hls:r2.5.4'
implementation 'com.amazon.android:exoplayer-dash:r2.5.4'
implementation 'com.amazon.android:extension-okhttp:r2.5.4'
implementation 'commons-net:commons-net:3.3'
implementation('android.arch.persistence.room:rxjava2:1.0.0-rc1') {
exclude group: 'com.android.support', module: 'support-compat'
exclude group: 'android.arch.persistence.room', module: 'runtime'
exclude group: 'com.android.support', module: 'support-core-utils'
}
implementation('android.arch.persistence.room:runtime:1.0.0-rc1') {
exclude group: 'com.android.support', module: 'support-compat'
exclude group: 'com.android.support', module: 'support-core-utils'
}
implementation 'android.arch.lifecycle:runtime:1.0.0-rc1'
implementation('android.arch.lifecycle:extensions:1.0.0-rc1') {
exclude group: 'com.android.support', module: 'support-compat'
exclude group: 'com.android.support', module: 'support-core-ui'
exclude group: 'com.android.support', module: 'support-core-utils'
}
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-rc1"
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-rc1"
annotationProcessor "com.jakewharton:butterknife:7.0.1"
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-v4:26.1.0'
}
应用程序级别 build.gradle
implementation 'com.google.android.exoplayer:exoplayer:2.7.3'
将您的SDK和关联的LIB升级到28 ...还将您的gradle升级到gradle-4.10.1-all.zip
...然后是rebuild
应用程序...然后从File
菜单中 Invalidate Cache/Restart
。
如果仍无法工作,请添加以下代码,并按照rebuild
和Invalidate Cache/Restart
implementation ('react-native-track-player') {
exclude group: 'com.google.android.exoplayer'
}
implementation 'com.google.android.exoplayer:exoplayer:2.7.3'