I've always added dependencies like this:
dependencies { compile 'com.android.support:mediarouter-v7:19.+' }
but in the recent versions of Android Studio, they recommend not to use the +
as it can lead to errors. How to know what's the latest version? I can try every combination of 19.y.x until gradle complains, but what's the real way do check?
edit: sometimes, that page helps me figure it out.
You can use the version string “latest. integration” to achieve this. This is a dynamic version that tells Gradle to use the very latest version of a dependency. Note that for a maven repository, this feature requires that the list of all available versions is published in a maven-metadata.
0 (May 2022) Android Gradle plugin 7.2. 0 is a major release that includes a variety of new features and improvements.
In Android Studio, go to File > Project Structure. Then select the "project" tab on the left. Your Gradle version will be displayed here. If you are using the Gradle wrapper, then your project will have a gradle/wrapper/gradle-wrapper.
There may be other ways, but here is what i use:
You can find out the latest version using Android Studio by replacing the version number of your library in build.gradle compile line, with just +
, and click on Sync Now
in upper right corner of the window.
in your case, for example
dependencies { compile 'com.android.support:mediarouter-v7:+' }
Android Studio will pop up a hint/bulb, which has options Replace with specific version
you can click, which will fill-in the latest version in-place of +
. Please see below screeshot:
If this doesn't work the first time, let gradle complete its sync, and retry (replace + with + or any file modification will do, click the sync now again and hint bulb will show up).
For example, for your library, i simply pasted this line compile 'com.android.support:mediarouter-v7:+'
under my dependencies and followed the above process, Android Studio filled in with below version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With