How to Fix Error:(59, 8) error: cannot access ActivityCompatApi23 class file for android.support.v4.app.ActivityCompatApi23 not found
For me, this was an uncommon error that occurred in the gradle settings of my new image search application, I believe this is some kind of version conflict error inside the gradle libraries.
My project would not compile, it showed random errors, this has been such a headache to me that I spend days searching for a solution, and finally found this solution.
How to apply this solution?
In your Build:gradle (module:app), just enter the code like the screenshot below
Code to fix cannot access ActivityCompatApi23 in Android Studio
configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '25.3.0' } } } }
Screenshot
Super cool, it looks like this will work for me!
I have to support very big and pretty old project which works correctly only with old version of support libraries (25.3.1). I had to use old version of android gradle plugin (2.3.3 !) because compilation breaks with this ActivityCompatApi23 error when you use more recent versions of gradle plugin with old version of support libraries. I think android gradle plugin 3.x.x just not compartible with old versions of support libraries althought I wasn’t able to find any information about it.
That makes me crazy because recent android studio version has lots of annoying compatibility issues with old android gradle plugins. Hope it will work and I will able to switch to the recent version of android gradle plugin.
How did you find this solution?
What it actually does and why it works?
Do you have more info about this problem or any other refrence?
Hi Dzmitry,
I found this solution from stackoverflow
I think this code tells the gradle to ignore version conflicts in the support libraries, i hope it works for you