In many of the answers on SO on this problem it has been suggested to add exclude 'META-INF/DEPENDENCIES' and some other excludes. However none of these worked for me. In my case scenario was like this:
I had added this in dependancies:
implementation 'androidx.annotation:annotation:1.1.0'
And also I had added this in gradle.properties:
android.useAndroidX=true
Both of these I had added, because I was getting build error 'cannot find symbol class Nullable' and it was suggested as solution to this on some of answers like here
However, eventually I landed up in getting error:
More than one file was found with OS independent path 'androidsupportmultidexversion.txt'
No exclude was working for me. Finally I just removed
implementation 'androidx.annotation:annotation:1.1.0'
from build.grdle file.
and finally I got rid of this
( More than one file was found with OS independent path 'androidsupportmultidexversion.txt' )
"More than one file was found with OS..." build error.
I wasted hours of mine.But didn't found solution of this.
Then i just change my project
minSdkVersion 19
to
minSdkVersion 21
And finally i am able to build my apk file without any error