首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >setParameters(Lcom/google/android/exoplayer2/trackselection/DefaultTrackSelector$Paramet : java.lang.NoSuchMethodError:没有虚拟方法

setParameters(Lcom/google/android/exoplayer2/trackselection/DefaultTrackSelector$Paramet : java.lang.NoSuchMethodError:没有虚拟方法
EN

Stack Overflow用户
提问于 2022-06-24 05:29:43
回答 2查看 541关注 0票数 0

我正面临这个问题与BrightCove视频播放器。玩家在内部使用系外球员。运行应用程序时,播放机只显示视频的海报,但单击播放时会显示下面提到的错误信息。我在应用程序中实现了多个模块,一个模块使用exo 2.17.1,一个模块使用Brightcove6.18.6和exo 2.14。

代码语言:javascript
运行
复制
E/com.brightcove.player.event.EventEmitterImpl@b1bc2d5: processEvent() threw a throwable.
java.lang.NoSuchMethodError: No virtual method setParameters(Lcom/google/android/exoplayer2/trackselection/DefaultTrackSelector$Parameters;)V in class Lcom/google/android/exoplayer2/trackselection/DefaultTrackSelector; or its super classes (declaration of 'com.google.android.exoplayer2.trackselection.DefaultTrackSelector' appears in /data/app/~~IcHQVEM5w4IXny6I30aQ9g==/com.test.demo-upkrdit2H5SqzTzsEzy8jw==/base.apk!classes2.dex)
    at com.brightcove.player.display.ExoPlayerVideoDisplayComponent.updateTrackSelectorPeakBitrate(ExoPlayerVideoDisplayComponent.java:2052)
    at com.brightcove.player.display.ExoPlayerVideoDisplayComponent.initializePlayer(ExoPlayerVideoDisplayComponent.java:1028)
    at com.brightcove.player.display.ExoPlayerVideoDisplayComponent.createPlayer(ExoPlayerVideoDisplayComponent.java:1015)
    at com.brightcove.player.display.ExoPlayerVideoDisplayComponent.openVideo(ExoPlayerVideoDisplayComponent.java:1086)
    at com.brightcove.player.display.VideoDisplayComponent.openCurrentVideoSource(VideoDisplayComponent.java:470)
    at com.brightcove.player.display.ExoPlayerVideoDisplayComponent$ExoPlayerOnSetSourceListener.processEvent(ExoPlayerVideoDisplayComponent.java:1288)
    at com.brightcove.player.event.EventEmitterImpl.invokeListenersForEventType(EventEmitterImpl.java:458)
    at com.brightcove.player.event.EventEmitterImpl.invokeListenersForEvent(EventEmitterImpl.java:429)
    at com.brightcove.player.event.EventEmitterImpl.access$300(EventEmitterImpl.java:42)
    at com.brightcove.player.event.EventEmitterImpl$1.handleMessage(EventEmitterImpl.java:74)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:257)
    at android.app.ActivityThread.main(ActivityThread.java:8218)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)

2022-06-24 10:48:46.138 31056-31056/com.test.demo E/com.brightcove.player.event.EventEmitterImpl@987c257: processEvent() threw a throwable.
    java.lang.NoSuchMethodError: No virtual method setParameters(Lcom/google/android/exoplayer2/trackselection/DefaultTrackSelector$Parameters;)V in class Lcom/google/android/exoplayer2/trackselection/DefaultTrackSelector; or its super classes (declaration of 'com.google.android.exoplayer2.trackselection.DefaultTrackSelector' appears in /data/app/~~IcHQVEM5w4IXny6I30aQ9g==/com.test.demo-upkrdit2H5SqzTzsEzy8jw==/base.apk!classes2.dex)
        at com.brightcove.player.display.ExoPlayerVideoDisplayComponent.updateTrackSelectorPeakBitrate(ExoPlayerVideoDisplayComponent.java:2052)
        at com.brightcove.player.display.ExoPlayerVideoDisplayComponent.initializePlayer(ExoPlayerVideoDisplayComponent.java:1028)
        at com.brightcove.player.display.ExoPlayerVideoDisplayComponent.createPlayer(ExoPlayerVideoDisplayComponent.java:1015)
        at com.brightcove.player.display.ExoPlayerVideoDisplayComponent.openVideo(ExoPlayerVideoDisplayComponent.java:1086)
        at com.brightcove.player.display.VideoDisplayComponent.openCurrentVideoSource(VideoDisplayComponent.java:470)
        at com.brightcove.player.display.ExoPlayerVideoDisplayComponent$ExoPlayerOnSetSourceListener.processEvent(ExoPlayerVideoDisplayComponent.java:1288)
        at com.brightcove.player.event.EventEmitterImpl.invokeListenersForEventType(EventEmitterImpl.java:458)
        at com.brightcove.player.event.EventEmitterImpl.invokeListenersForEvent(EventEmitterImpl.java:429)
        at com.brightcove.player.event.EventEmitterImpl.access$300(EventEmitterImpl.java:42)
        at com.brightcove.player.event.EventEmitterImpl$1.handleMessage(EventEmitterImpl.java:74)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:257)
        at android.app.ActivityThread.main(ActivityThread.java:8218)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:626)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1015)

我的项目配置是

代码语言:javascript
运行
复制
    /*
 * Copyright (C) 2016 - present Instructure, Inc.
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, version 3 of the License.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

import com.test.android.buildtools.transform.*

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.squareup.sqldelight'
apply plugin: 'dagger.hilt.android.plugin'

def updatePriority = 2
def coverageEnabled = project.hasProperty('coverage')

sqldelight {
    StudentDb {
        packageName = "com.test.student.db"
        sourceFolders = ["db"]
        schemaOutputDirectory = file("src/main/db/schemas")
    }
}


configurations {
    all*.exclude group: 'commons-logging', module: 'commons-logging'
    all*.exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}

androidExtensions {
    experimental = true
}

android {
    compileSdkVersion Versions.COMPILE_SDK
    buildToolsVersion Versions.BUILD_TOOLS

    defaultConfig {
        applicationId "com.test.app"
        minSdkVersion Versions.MIN_SDK
        targetSdkVersion Versions.TARGET_SDK
        versionCode = 236
        versionName = '6.16.3'

        vectorDrawables.useSupportLibrary = true
        multiDexEnabled = true
        testInstrumentationRunner 'com.test.student.espresso.StudentHiltTestRunner'
        testInstrumentationRunnerArguments disableAnalytics: 'true'
        buildConfigField "boolean", "IS_TESTING", "false"

        /* Add private data */
        PrivateData.merge(project, "student")
        testBuildType = "debug"
        multiDexKeepFile = file('multidex-config.txt')
    }

    bundle {
        language {
            // Specifies that the app bundle should not support configuration APKs for language resources. These
            // resources are instead packaged with each base and dynamic feature APK.
            enableSplit = false
        }
    }

    packagingOptions {
        exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
        exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/rxjava.properties'
        exclude 'LICENSE.txt'
    }

    lintOptions {
        abortOnError false
        // Work around for AGP issue related to release mode, see:
        // https://github.com/flutter/flutter/issues/58247#issuecomment-636253593
        checkReleaseBuilds false
    }

    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
    }

    buildTypes {

        debug {
            testCoverageEnabled = coverageEnabled
            debuggable true
            minifyEnabled false
            shrinkResources false
            buildConfigField 'boolean', 'IS_DEBUG', 'true'
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            pseudoLocalesEnabled true
            multiDexKeepProguard = file('multidex-config.pro')

            firebaseCrashlytics {
                mappingFileUploadEnabled false
            }

            ndk {
                // Filter for architectures supported by Flutter. Include x86 in debug builds so we don't crash on FTL.
                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64', 'x86'
            }
        }

        release {
            debuggable false
            minifyEnabled true
            shrinkResources true
            buildConfigField 'boolean', 'IS_DEBUG', 'false'
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            multiDexKeepProguard = file('multidex-config.pro')
            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
            }

            ndk {
                // Filter for architectures supported by Flutter. Exclude x86 in release builds to avoid missing lib crash on x86 devices.
                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
            }
        }
    }

    flavorDimensions 'default'

    productFlavors {
        dev {
            dimension 'default'
        }

        qa {
            buildConfigField "boolean", "IS_TESTING", "true"
            dimension 'default'
        }

        prod {
            dimension 'default'
        }
    }

    // Always show the result of every unit test, even if it passes.
    testOptions.unitTests.all {
        testLogging {
            events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
        }
    }

    testOptions.unitTests.includeAndroidResources = true
    testOptions.animationsDisabled = true

    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
        /*
        Resolves dependency versions across test and production APKs, specifically, transitive
        dependencies. This is required since Espresso internally has a dependency on support-annotations.
        https://github.com/googlecodelabs/android-testing/blob/57852eaf7df88ddaf828eca879a407f2249d5348/app/build.gradle#L86
        */
        resolutionStrategy.force Libs.ANDROIDX_ANNOTATION

        resolutionStrategy.force Libs.KOTLIN_COROUTINES_CORE

        // Some libraries want to resolve never versions of this library that requires targetSdkVersion 31.
        // Once we upgrade the targetSdkVersion this should be removed.
        resolutionStrategy.force 'androidx.core:core:1.6.0'
        resolutionStrategy.force 'androidx.core:core-ktx:1.6.0'
    }

    /*
    All direct/transitive dependencies shared between your test and production APKs need to be
    excluded from the test APK! This is necessary because both APKs will contain the same classes. Not
    excluding these dependencies from your test configuration will result in an dex pre-verifier error
    at runtime. More info in this tools bug: (https://code.google.com/p/android/issues/detail?id=192497)
    */
    configurations.implementation.dependencies.each { compileDependency ->
        println "Excluding compile dependency: ${compileDependency.getName()}"
        configurations.androidTestImplementation.dependencies.each { androidTestCompileDependency ->
            configurations.androidTestImplementation.exclude module: "${compileDependency.getName()}"
        }
    }

    dexOptions {
        javaMaxHeapSize '4g'
    }

    registerTransform(
            new ProjectTransformer(
                    android,
                    new MasqueradeUITransformer('com.test.app.activity.NavigationActivity.class'),
                    new PageViewTransformer(),
                    new ScreenViewTransformer("user"),
                    new LocaleTransformer(project),
                    new FlutterA11yOffsetTransformer(),
                    new FlutterTextureDisconnectFix()
            )
    )

    compileOptions {
        sourceCompatibility 1.8
        targetCompatibility 1.8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }

    buildFeatures {
        dataBinding true
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
    }

    hilt {
        enableTransformForLocalTests = true
    }
}

dependencies {
    implementation 'com.android.support:multidex:2.0.1'
    implementation project(path: ':panda_annotations')
    kaptAndroidTestQa project(path: ':panda_processor')
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    /* Project Modules */
    implementation project(path: ':login-api-2')
    implementation project(path: ':rceditor')
    implementation project(path: ':interactions')
    implementation project(path: ':DocumentScanner')

    /* Flutter embed */
    implementation(project(path: ':flutter-student-embed')) {
        exclude group: 'com.google.firebase'
        exclude group: 'com.google.android.gms'
    }

    /* Android Test Dependencies */
    androidTestImplementation project(path: ':espresso')
    androidTestImplementation project(':dataseedingapi')

    /* Unit Test Dependencies */
    testImplementation Libs.JUNIT
    testImplementation Libs.ROBOLECTRIC
    testImplementation Libs.ANDROIDX_TEST_JUNIT
    testImplementation Libs.MOCKK
    androidTestImplementation Libs.ANDROIDX_TEST_JUNIT
    testImplementation Libs.KOTLIN_COROUTINES_TEST
    testImplementation Libs.FIREBASE_CORE
    testImplementation Libs.THREETEN_BP
    testImplementation Libs.ANDROIDX_CORE_TESTING

    /* Firebase */
    implementation platform(Libs.FIREBASE_BOM)
    implementation Libs.FIREBASE_MESSAGING
    implementation Libs.FIREBASE_CRASHLYTICS_NDK
    implementation(Libs.FIREBASE_ANALYTICS) {
        transitive = true
    }
    implementation(Libs.FIREBASE_CRASHLYTICS) {
        transitive = true
    }

    /* Kotlin */
    implementation Libs.KOTLIN_STD_LIB

    /* Mobius */
    implementation Libs.MOBIUS_CORE
    testImplementation Libs.MOBIUS_TEST
    implementation Libs.MOBIUS_ANDROID
    implementation Libs.MOBIUS_EXTRAS

    /* Media Handling */
    implementation Libs.PHOTO_VIEW
    implementation Libs.LOTTIE

    /* Sliding Panel */
    implementation Libs.SLIDING_UP_PANEL

    /* Apache Commons */
    implementation Libs.APACHE_COMMONS_TEXT

    /* Support dependencies */
    implementation Libs.ANDROIDX_ANNOTATION
    implementation (Libs.ANDROIDX_APPCOMPAT) {
        force = true
    }
    implementation Libs.ANDROIDX_BROWSER
    implementation Libs.ANDROIDX_CARDVIEW
    implementation Libs.ANDROIDX_CONSTRAINT_LAYOUT
    implementation Libs.ANDROIDX_DESIGN
    implementation Libs.ANDROIDX_RECYCLERVIEW
    implementation Libs.PLAY_SERVICES_ANALYTICS
    implementation Libs.ANDROIDX_PALETTE
    implementation Libs.PLAY_CORE

    /* Database */
    implementation Libs.SQLDELIGHT

    /* Qr Code */
    implementation Libs.JOURNEY_ZXING

    /* AAC */
    implementation Libs.VIEW_MODEL
    implementation Libs.LIVE_DATA
    implementation Libs.VIEW_MODE_SAVED_STATE
    implementation Libs.FRAGMENT_KTX
    kapt Libs.LIFECYCLE_COMPILER

    /* DI */
    implementation Libs.HILT
    kapt Libs.HILT_COMPILER
    androidTestImplementation Libs.HILT_TESTING
    kaptAndroidTestQa Libs.HILT_TESTING_COMPILER

    androidTestImplementation Libs.UI_AUTOMATOR

    /*PDF READER*/
    implementation Libs.PDF_READER

    /*BrightCove video*/
    implementation Libs.BRIGHT_COV_VIDEO
    implementation "com.brightcove.player:android-appcompat-plugin:6.18.6"

    /*Viewpager video player*/
    implementation Libs.VIEW_PAGER

    /*JSOUP*/
    implementation Libs.JSOUP
}

// Comment out this line if the reporting logic starts going wonky.
gradle.addListener new TimingsListener(project)

apply plugin: 'com.google.gms.google-services'

if (coverageEnabled) {
    // ./gradlew -Pcoverage firebaseJacoco
    task firebaseJacoco(type: JacocoReport) {
        group = "Reporting"
        description = "Generate Jacoco coverage reports for Firebase test lab."

        def productFlavor = 'qa'
        def buildType = 'debug'

        classDirectories.setFrom fileTree(
                dir: "${project.buildDir}/tmp/kotlin-classes/qaDebug",
                excludes: ['**/R.class',
                           '**/R$*.class',
                           '**/*$ViewInjector*.*',
                           '**/*$ViewBinder*.*',
                           '**/BuildConfig.*',
                           '**/Manifest*.*',
                           '**/generated/**',
                           '**/*Receiver*.*',
                           '**/model*/**',
                           '**/di/**',
                           '**/service*/**'],
        )

    }

}

我的原始文件是

代码语言:javascript
运行
复制
-keep public class com.google.android.exoplayer2.**{*;}
-keep public class com.brightcove.player.**{*;}
-keep  interface com.google.android.exoplayer2.**{*;}
-keep  interface com.brightcove.player.**{*;}

-keepclassmembers class ** {
    @com.google.android.exoplayer2.trackselection.DefaultTrackSelector$Parameters <methods>;
}


-keepclasseswithmembers class * {
    @com.brightcove.player.* <methods>;
}

我的一个模块使用Exo作为一个单独的依赖项,另一个模块使用brightcove player。

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72739369

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档