0

Good day, I am trying to use Fast Adapter library in my project. I read the installation guide from this link https://github.com/mikepenz/FastAdapter. The synchronization of my project successfully built but I got this warning (captured link) that says,

"It looks like you are trying to substitute a version variable, but using single quotes (')."

implementation 'com.android.support:appcompat-v7:${latestSupportLib}'

Although the project was successfully built, it so annoying for me to see the red line under the implemented library. Is it okay to ignore that warning or is there any way to fix that warning?

enter image description here

Milind Mevada
  • 3,145
  • 1
  • 14
  • 22

1 Answers1

0

You should replace

implementation 'com.android.support:appcompat-v7:${latestSupportLib}'

with

implementation "com.android.support:appcompat-v7:${latestSupportLib}"

or

implementation 'com.android.support:appcompat-v7:27.1.1'

(where 27.1.1 is the current latest stable version of the Android support library).

See http://docs.groovy-lang.org/latest/html/documentation/#_string_interpolation (my emphasis):

Any Groovy expression can be interpolated in all string literals, apart from single and triple single quoted strings.

(The fact that the project currently builds at all surprises me!)

stkent
  • 19,772
  • 14
  • 85
  • 111
  • Thanks for your answer but when I tried that and synchronize it will gives me an error that says `Could not get unknown property 'latestSupportLib' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.` – Mak-Mak Basaya Jul 27 '18 at 11:12
  • Edited my answer; if you don't already have a variable defined somewhere that contains the version of the Android support libraries you are using in your project, you can avoid the string interpolation altogether and just write the version you wish to use inline as per my second example. – stkent Jul 27 '18 at 11:16