找不到符号ExoPlayerFactory

时间:2019-06-04 23:38:31

标签: android android-gradle exoplayer2.x

我要疯了,试图找出答案。这根本没有意义。我已经在我的build.gradle文件中添加了所需的实现,并进行了同步,但是当我尝试使用ExoPlayer时却找不到。我什至尝试使用自动完成功能手动输入导入行,而com.google.android.exoplayer2Buildconfig可以自动完成的唯一操作是R.,我不知道发生了什么。我有一个使用它的项目,一切都很棒。我已经很久没有打开它了,但是我想重新学习它,所以我打开了它,现在不管怎么做都找不到ExoPlayer的符号。

这是我的build.gradle文件...

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "test.notreal.justatext"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
    compileOptions {
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v13:28.0.0' //THIS
    implementation 'com.android.support:support-media-compat:28.0.0' //AND THIS
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-auth:17.0.0'
    implementation 'com.google.firebase:firebase-database:17.0.0'
    implementation 'com.google.firebase:firebase-storage:17.0.0'
    implementation 'de.hdodenhof:circleimageview:1.3.0'
    implementation 'com.soundcloud.android:android-crop:1.0.1@aar'
    implementation 'com.jakewharton:butterknife:9.0.0-rc2'
    annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc2'
    implementation 'com.github.jd-alexander:LikeButton:0.2.3'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'fr.tvbarthel.blurdialogfragment:lib:2.2.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.scottyab:aescrypt:0.0.1'
    implementation 'com.daimajia.slider:library:1.1.5@aar'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
    implementation 'com.google.android.exoplayer:exoplayer:r2.5.0' //RIGHT HERE
    implementation 'com.bignerdranch.android:recyclerview-multiselect:0.2'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
    testImplementation 'junit:junit:4.12'
    implementation 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1'
    implementation 'jp.wasabeef:glide-transformations:3.0.1'

}





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

在其中您可以看到...

implementation 'com.google.android.exoplayer:exoplayer:r2.5.0'

该应用将正确执行gradle同步,但是在我的应用中,以下所有内容均为红色...

import com.google.android.exoplayer2.ExoPlayerFactory;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.extractor.DefaultExtractorsFactory;
import com.google.android.exoplayer2.extractor.ExtractorsFactory;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.TrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelector;
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
import com.google.android.exoplayer2.upstream.BandwidthMeter;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.Util;

exoplayer2之后的所有内容。是红色的。它找不到任何符号。为了确保自己不会发疯,我开始了一个新项目,在我的干净clean.build文件中添加了exoplayer的实现,打开了主要活动并输入

SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(this);

它找不到符号。无法导入它,它仍然只显示BuildConfig之后的所有内容的Rcom.google.android.exoplayer2.符号,我尝试更新到2.10.1之类的较新版本,这会导致构建失败。有关在全新的干净应用程序上合并android清单失败的信息。因此,我无法更新版本,但是突然之间,无论我做什么,Android Studio都找不到ExoPlayer符号。

1 个答案:

答案 0 :(得分:2)

您使用的版本太旧了,可能与Gradle版本冲突。 您可以尝试降级Gradle版本或升级Exoplayer 建议使用最新的version