小编Jos*_*e Q的帖子

错误:无法访问InternalTokenProvider(Firebase / GooglePlayServices)

在我使用firebase,firebase-ui,google maps等的应用程序中,它运行良好。我想更新到每个库的最新版本并安装Firebase Performance。

我得到的错误是:

error: cannot access InternalTokenProvider
class file for com.google.firebase.internal.InternalTokenProvider not found
Run Code Online (Sandbox Code Playgroud)

当我单击此错误时,它会将我发送到活动的这一行:

auth = FirebaseAuth.getInstance();
Run Code Online (Sandbox Code Playgroud)

这是我的build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'

android {
    signingConfigs {
        release {
            //signin things
        }
    }
    compileSdkVersion 28
    defaultConfig {

        applicationId "app.example.asd"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 22
        versionName "2"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        signingConfig signingConfigs.release
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors …
Run Code Online (Sandbox Code Playgroud)

android google-maps firebase google-play-services firebaseui

5
推荐指数
2
解决办法
7062
查看次数

ExoPlayer 有时会从 url 返回 mp3 文件的负持续时间

我正在制作一个应用程序,可以从 URL 播放 .mp3 文件。我正在使用最新版本的 ExoPlayer 2.11.4。

我需要做的是从 url 获取音频的总持续时间,以便我可以在自定义音频播放器中使用它。

我使用的网址属于这种类型:https://myserver.net/.../audio/439688e0c3626d39d3ef3.mp3 ?token=6oz-22-2sa-9yh-7e-2iak

问题是有时我的代码在大多数情况下都能正常工作并返回正确的持续时间。但有时我得到的是负数:-9223372036854775807

这不允许我的代码正常工作。我获得持续时间的代码是这样的:

fun getDuration(url: String, context: Context) {
        exoPlayer?.release()

        exoPlayer = SimpleExoPlayer.Builder(context).build()
        val dataSourceFactory = DefaultDataSourceFactory(context, Util.getUserAgent(context, "ExoPlayer"))
        val mediaSource = ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse(url))

        exoPlayer?.prepare(mediaSource)

        exoPlayer?.addListener(object : Player.EventListener {
            override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) {
                if (playbackState == ExoPlayer.STATE_READY) {
                    val realDurationMillis: Long? = exoPlayer?.getDuration()
                    currentDuration = realDurationMillis
                    if (currentDuration != null) {
                        if (currentDuration!! > 0) {
                            exoPlayer?.release()
                        }
                    }

                }
            }
        })
    }
Run Code Online (Sandbox Code Playgroud)

android kotlin exoplayer exoplayer2.x

5
推荐指数
1
解决办法
1272
查看次数