Closed junhoi-pk closed 3 years ago
I don't see the warnings you mention when compiling the demo app at 2.12.0:
$ ./gradlew :demo:assembleNoDecoderExtensionsRelease
Without being able to reproduce the problem it's very hard to determine where it's coming from.
Please provide a minimal reproducible example that demonstrates the problem in a way that we can build locally.
This could be an Android Studio project on GitHub, or zipped up and sent to dev.exoplayer@gmail.com using a subject in the format "Issue #1234", where "#1234" should be replaced with your issue number. Please also update this issue to indicate you’ve done this.
@icbaker
I made a sample If you run the command below, you may encounter a warning
$ git clone https://github.com/junhoi-pk/ExoPlayerBuildError.git
$ cd ExoPlayerBuildError
$ ./gradlew :app:minifyDebugWithProguard
And you can see that there are no errors if you change the version to 2.11.8 and repeat again.
Thx
Thanks for the project, I can repro with your instructions.
I can also repro in the demo app by adding android.enableR8=false
to gradle.properties. This repros at both dev-v2 and 2.12.0. And equally I can fix your project by removing that line and running:
$ ./gradlew :app:minifyDebugWithR8
So the error only seems to occur when using ProGuard instead of R8.
Note that enableR8
is a deprecated option, it prints this warning in my build log:
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
I think this is related to some dependencies that Guava pulls in and only uses at compile-time. We deliberately exclude these here: https://github.com/google/ExoPlayer/blob/5b1514e933f1bd7415737af3c2323f47f08f0b64/library/common/build.gradle#L19-L27
I was able to get the demo app building at dev-v2 with android.enableR8=false
as follows:
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'org.checkerframework:checker-qual:2.5.2'
implementation 'com.google.errorprone:error_prone_annotations:2.2.0'
implementation 'com.google.j2objc:j2objc-annotations:1.1'
common
module's proguard-rules.txt (from Guava's suggested ProGuard config):
-dontwarn javax.lang.model.element.Modifier
I made similar changes to your project, but had to make two additions:
implementation 'org.codehaus.mojo:animal-sniffer-maven-plugin:1.17'
-dontwarn sun.misc.Unsafe
That then produces a different error:
$ ./gradlew :app:minifyDebugWithProguard
> Configure project :app
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
> Task :app:mergeDebugJavaResource FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> More than one file was found with OS independent path 'META-INF/DEPENDENCIES'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 5s
13 actionable tasks: 3 executed, 10 up-to-date
It seems like the easiest fix is to switch your app from ProGuard to R8 - if that's possible.
If you need to keep using ProGuard I suggest you make the changes described above to depend explicitly on dependencies that Guava only uses at compile-time.
Ah my steps to fix the demo app in the comment above don't work to fix the problem - I had some other changes in the same project that were interfering and I didn't realise.
Let me come back with another update shortly.
OK, trying again :)
Thanks for the project, I can repro with your instructions.
I can also repro in the demo app by adding android.enableR8=false
to gradle.properties. This repros at both dev-v2 and 2.12.0. And equally I can fix your project by removing that line and running:
$ ./gradlew :app:minifyDebugWithR8
So the error only seems to occur when using ProGuard instead of R8.
Note that enableR8
is a deprecated option, it prints this warning in my build log:
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
I think this is related to some dependencies that Guava pulls in and only uses at compile-time. We deliberately exclude these here: https://github.com/google/ExoPlayer/blob/5b1514e933f1bd7415737af3c2323f47f08f0b64/library/common/build.gradle#L19-L27
We already -dontwarn
for other compile-only dependencies in our ProGuard config, so I'm going to add additional suppressions. That seems to fix the problem for me, both in your app and the demo app.
A warning occurs when applying proguard from version 2.12.0. (2.12.1 is equal)
My dependencies are below.
During build, the following error occurs.
What should I apply to ProGuard?