ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

"cannot resolve symbol: util" in ExoPlayer 2.6.1 - previously worked fine

Open ixfd64 opened this issue 7 years ago • 6 comments

Since a few days ago, our projects that use ExoPlayer 2.6.1 no longer compile. Android Studio now gives a cannot resolve symbol: util error even though they have previously compiled without problems.

Steps to reproduce:

  1. Create a new project in Android Studio.
  2. Add ExoPlayer 2.6.1 as a build dependency by putting implementation 'com.google.android.exoplayer:exoplayer:2.6.1' in the build.gradle file for the application module.
  3. Create a new Java class and import the com.google.android.exoplayer2.util.Util package.

Expected behavior:

Gradle should sync and the app should compile.

Actual behavior:

Android Studio throws up a cannot find symbol: util error. Changing the Gradle import to

implementation 'com.google.android.exoplayer:exoplayer-core:2.6.1'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.6.1'

resolves the problem.

As I mentioned earlier, our projects that use ExoPlayer 2.6.1 previously worked without any issues. The repository shows that ExoPlayer 2.6.1 does have a util folder. Has there been a change in the Gradle package?

ixfd64 avatar May 13 '19 21:05 ixfd64

That sounds odd indeed. Since you haven't changed the ExoPlayer version it seems to me that it can't be a problem caused by ExoPlayer as there is no change of it.

Did you change something else like updated Android Studio or Gradle Version of you project? What versions of Android Studio and gradle are you using?

In general I'd recommend to use the most recent version of everything, like ExoPlayer, Android Studio and Gradle.

marcbaechinger avatar May 14 '19 09:05 marcbaechinger

Thanks for your response. After further investigation, I found that the issue appears to be caused by an incompatibility with Gradle. The error went away after I downgraded back to an earlier Gradle version.

For the record, later ExoPlayer versions don't seem to have this problem.

ixfd64 avatar May 14 '19 18:05 ixfd64

I'm having the same error. As @ixfd64 said, I could workaround it by downgrading Gradle Android plugin from 3.4.0 to 3.2.0 and gradle-wrapper.properties from 5.1.1 to 4.10.1. This is the last configuration that worked

build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        // ...
    }
}

gradle-wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

app/build.gradle implementation 'com.google.android.exoplayer:exoplayer:r2.5.3'

After downgrading Gradle, exoplayer versions r2.5.2, r2.5.3, r2.5.4 seem to work fine, but none of them works with Gradle 3.4.0 - gradle-wrapper 5.1.1. Has anyone found a way to make it work after upgrading Gradle?

Thanks in advance!

voghDev avatar May 29 '19 12:05 voghDev

I'm facing the exact same issue as @voghDev and couldn't find any solution other than downgrading Gradle version

cpienovi avatar Jun 21 '19 16:06 cpienovi

@ixfd64 could you please provide some extra information such as the versions of Gradle, gradle-wrapper, Android Studio you're using, so @marcbaechinger or anyone who is reviewing this can do a deeper research? :) thx

voghDev avatar Jun 24 '19 06:06 voghDev

I'm using the following versions:

Android Studio 3.4 Gradle plug-in 2.3.3 (downgraded from latest) Gradle 4.1 (downgraded from latest)

ixfd64 avatar Jun 24 '19 22:06 ixfd64