ERROR: [TAG] Failed to resolve variable '${project.version}'

To answer your specific question here, your problem as seen in your logs is from the fact that your library called "'android.support.v4.widget' cannot be safely rewritten."

the flag in the gradle.properties file as seen here below is responsible for initiating this auto migration of libraries to androidx if set to true..

imagescreenshot

For more education for those also having this problem with other libraries and how to solve it;

  1. Open your gradle.properties file and if you see that the flag in the picture below that been set to "true", it means the Android plugin automatically migrates existing third-party libraries to use AndroidX dependencies by rewriting their binaries. The flag is false by default if it is not specified at all in your gradle.properties file.

imagescreenshot

So, If this automatic migration is somehow not working for you, you can decide to do this migration manually on your libraries one-by-one..., by setting the flag to false..

Also on a personal note, i once got this problem with a new project i was building.. And then i set the flag to false, rebuilt the project (got the AndroidX error warnings), and set it back to true again, and the problem somehow solved when rebuilt.
So probably that could help you too


This solution worked for me:

I have added this to app's gradle file:

android {
    ...
    ...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

I have also removed this line from manifests file:

tools:replace="..."

In gradle.properties: (I have disabled Jetifier)

android.useAndroidX=true
android.enableJetifier=false