当前位置: 首页 > 知识库问答 >
问题:

com/google/android/exoplayer2/upstream/DefaultAllocator的NoSuchMethodError

湛联
2023-03-14

我在用

通用域名格式。亚马逊。android:exoplayer用户界面:r2。5.4

在我的项目中,我刚刚将IDE升级到Android Studio 3.3.1。在我的build.gradle中,我有下面的编译代码

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

在尝试构建时,我得到了这个错误:

任务:app:mergextdexdebug失败AGPBI:{“种类”:“错误”,“文本”:“默认接口方法仅支持从Android N开始(--min api 24):void com.google.Android.exoplayer2.Player$EventListener.onLoadingChanged(布尔)”,“源”:[{}],“工具”:“D8”}

失败:生成失败,出现异常。

  • 错误:无法解析配置的所有文件“:app:debugRuntimeClasspath”。无法转换文件的类。jar'匹配属性{artifactType=android dex,dexing is debugable=true,dexing min sdk=21}使用transform DexingTransform Error进行索引时

当我将sourceCompatibilitytargetCompatibility更改为JavaVersion时。版本_1_8,它成功生成,但应用程序崩溃,出现以下错误:

E/AndroidRuntime:致命异常:主进程:com。mypackage,PID:4374 java。lang.NoSuchMethodError:没有直接方法(Lcom/google/android/exoplayer2/upstream/DefaultAllocator;iijjjlcom/google/android/exoplayer2/util/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"
        }
    }
}

应用程序构建。格拉德尔

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'
}

共有1个答案

龚勇锐
2023-03-14

应用程序级别build中添加以下代码。格雷德尔

implementation 'com.google.android.exoplayer:exoplayer:2.7.3'

将您的SDK和关联库升级到28...还可以将Gradle升级到gradle-4.10.1-all.zip...然后重建应用...然后从File菜单中无效缓存/重新启动

如果仍不工作,则添加以下代码,并按照重建使缓存无效/重新启动

implementation ('react-native-track-player') {
    exclude group: 'com.google.android.exoplayer'
}
implementation 'com.google.android.exoplayer:exoplayer:2.7.3'
 类似资料:
  • 如何在ExoPlayer2上设置字幕?我试过这个媒体来源: 但我犯了一个错误:

  • 依赖关系{compile fileTree(include:['*.jar'],dir:'libs')testCompile'junit:junit:4.12' 编译'com.firebaseui:firebase-ui-auth:3.2.2' }

  • upstream模块 (100%) nginx模块一般被分成三大类:handler、filter和upstream。前面的章节中,读者已经了解了handler、filter。利用这两类模块,可以使nginx轻松完成任何单机工作。而本章介绍的upstream模块,将使nginx跨越单机的限制,完成网络数据的接收、处理和转发。 数据转发功能,为nginx提供了跨越单机的横向处理能力,使nginx摆脱只

  • Limits retries for upstream servers (proxy, memcached, fastcgi, scgi, uwsgi). Using one of the directives below will enable this feature. Example http { upstream test { server 127.0.0.1:80

  • 限制每个请求对后端服务器访问的最大尝试次数,支持proxy、memcached、fastcgi、scgi和uwsgi模块。 可以使用下面的指令开启访问次数进行限制。 Example http { upstream test { server 127.0.0.1:8081; server 127.0.0.2:8081; server 127.0