【问题标题】:getTitle,getDescription,createPendingIntent(), getLargeIcon() missing in Playback Notifications with ExoPlayerExoPlayer 的播放通知中缺少 getTitle、getDescription、createPendingIntent()、getLargeIcon()
【发布时间】:2019-02-17 15:47:25
【问题描述】:

我正在尝试实现Playback Notifications with ExoPlayer。但是缺少 getTitle、getDescription、createPendingIntent()、getLargeIcon 并且 android studio 显示红色(无法解析方法)。我怎样才能得到这些?

我编写的代码与链接完全相同。我试了很多次。

这是我的 build.gradle 文件(如果需要):

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.mediaplayertest"
        minSdkVersion 18
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation "com.android.support:support-media-compat:28.0.0"
    implementation "com.android.support:support-compat:28.0.0"

    implementation 'com.google.android.exoplayer:exoplayer:2.9.5'
}

【问题讨论】:

    标签: android audio exoplayer exoplayer2.x


    【解决方案1】:

    你需要正确定义gradle实现。

    来自The hello world example

    implementation 'com.google.android.exoplayer:exoplayer-core:2.X.X'
    implementation 'com.google.android.exoplayer:exoplayer-dash:2.X.X'
    implementation 'com.google.android.exoplayer:exoplayer-ui:2.X.X'
    

    在您的 gradle 构建脚本中,您只需要“exoplayer”

    注意:对于 PlaybackNotificationManager 类,您将需要 exoplayer-ui 表示您只需要该特定类 implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.5' 但我也会包含 exoplayer-core

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-15
      • 2021-01-08
      • 1970-01-01
      • 2013-09-18
      相关资源
      最近更新 更多