Exoplayer: Check support for Gradle 4.4

Created on 15 Jan 2018  路  19Comments  路  Source: google/ExoPlayer

Gone through tutorial

  1. I've cloned the repository
  2. Checked out release-v2
  3. Added suggested lines to settings.gradle

Got an error
Error:Cannot create variant 'android-lint' after configuration ':exoplayer-library-core:debugRuntimeElements' has been resolved

bug

Most helpful comment

I've checked with old gradle version (4.1) and it worked.
Seems, the current gradle 4.4 is not supported by your build scripts

All 19 comments

I've checked with old gradle version (4.1) and it worked.
Seems, the current gradle 4.4 is not supported by your build scripts

We'll keep this open until we confirm ExoPlayer works with gradle 4.4.

I tried using gradle 4.4 and things seem to work fine with 2.7.1. If you're still seeing issues with 2.7.1, please provide detailed reproduction steps. Thanks!

This is still an issue, I think.

Is there a manual way to fix this issue? Or only downgrade Android Studio to previous version?

@needz there is hardly any connection to Android Studio version. You can just decrease gradle version in gradle-wrapper.properties

@lintax, after upgrading to Android Studio 3.1 the minimum required gradle version is 4.4, so I can鈥檛 really downgrade it. Already tried.

@needz yeah, not realized that 3.1 was released already
As a quick-but-not-fast-to-do-fix, I think you can make a separate project to build your exoplayer version with old Android Studio and gradle versions, and depend on already built aar in the main project.
Or yes, revert to previous version.

I just came across the same error - updated AS to 3.1 and my project wouldn't compile anymore.
I replaced AS 3.1 with 3.0.1 and wanted to downgrade the gradle version in gradle wrapper properties, but also in AS 3.0.1 it tells me Gradle 4.4 is the minimum. I believe I had the same config working fine half an hour ago and now I can't compile my project anymore.
(I'm using ExoPlayer 2.7.1 in my project)

Any suggestions?

error: Error:Cannot create variant 'android-lint' after configuration ':exoplayer-library-core:debugRuntimeElements' has been resolved

Stupid me upgrade Android Studio to 3.1.0.
Redownload to 3.0.1 and it works now. Wait for exoplayer to support 4.4 then upgrade people!

after going back from AS 3.1 to older 3.0.1 and setting
classpath 'com.android.tools.build:gradle:3.1.0'
to
classpath 'com.android.tools.build:gradle:3.0.1'
in top level build.gradle
and setting
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
in gradle wrapper properties it's working again for me.

(But to be honest I'm not sure whether that's the same I had in there before, feels correct though)

Is there an easy way to downgrade to 3.0.1 without full uninstall of 3.1?

Here are reproduction steps

git clone https://github.com/google/ExoPlayer.git
cd ExoPlayer
git checkout origin/release-v2
git apply ../Gradle-3.1.0.patch
./gradlew build


> Configure project :demo 
WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :demo-cast 
WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :demo-ima 
WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :library-core 
WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :extension-cast 
WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.0.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.


FAILURE: Build failed with an exception.

* Where:
Script '/home/tao/AndroidStudioProjects/ExoPlayer/javadoc_library.gradle' line: 23

* What went wrong:
A problem occurred configuring project ':extension-cast'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':extension-cast:releaseCompileClasspath'.
      > A problem occurred configuring project ':library-core'.
         > Failed to notify project evaluation listener.
            > Cannot create variant 'android-lint' after configuration ':library-core:debugRuntimeElements' has been resolved
            > No such property: FOR_RUNTIME for class: org.gradle.api.attributes.Usage
   > No such property: FOR_RUNTIME for class: org.gradle.api.attributes.Usage

* 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

Here is patch:

From 46d6edf6b76afbd77e7048c094f5a03284345c66 Mon Sep 17 00:00:00 2001
From: Me
Date: Tue, 27 Mar 2018 15:27:12 +0200
Subject: [PATCH] Gradle 3.1.0

---
 build.gradle                             | 2 +-
 gradle/wrapper/gradle-wrapper.properties | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/build.gradle b/build.gradle
index 9f9081a94..313585f0a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,7 +17,7 @@ buildscript {
         google()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.0.1'
+        classpath 'com.android.tools.build:gradle:3.1.0'
         classpath 'com.novoda:bintray-release:0.5.0'
     }
     // Workaround for the following test coverage issue. Remove when fixed:
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 32ec7e332..5559e8ccf 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
-- 
2.14.1

I'm able to work around this by updating the bintray version to 0.8.0 and removing the classpath lines from javadoc_combined.gradle and javadoc_library.gradle. More explanation here

We have a fix for this that will be pushed to the dev-v2 branch shortly.

@ojw28, can you also give an answer on how to solve this with exoplayer v2.2.0 as I am not in a position to upgrade the player yet.

@ram992, unless you're building ExoPlayer from source I don't think this should affect earlier versions. If you are building from source then you could not do that. If you need to build from source because you've forked the library and have custom code in it, then maintaining that branch is your responsibility. You'd need to look at back-porting the fix reference above into your fork.

Thanks @ojw28, I was able to fix it. Posting the change here, so that some one else can use, as this is the first link that pops in google
1) Increase your com.novoda:bintray-release:x.y.z to 0.8.0
2) Add this code as given by the above reference Fixed in 13592df
doFirst{
classpath = files(variant.javaCompile.files,
project.android.getBootClasspath())
}
doLast {
copy {
from "src/main/javadoc"
into "$buildDir/docs/javadoc"
}
project.fixJavadoc()
}
comment out classpath line that is already there. You have to do it if you are in versions below than 2.4.x as I believe in the next versions, gradle dependency is changed. changes will be in build.gradle file of Exoplayer lib

Was this page helpful?
0 / 5 - 0 ratings