Hey i am getting this error while building game into APK from Mac. its work fine on window but not in MAC. Java SDK i think is 8
Try this On Android Studio File > Invalidate Caches & Restart close and re-open android studio after doing above step.Clean project and try to build it.Let me know how it goes.
Install Android SDK Platform 24 and 25 and try. Also check that you have Java JDK 1.8 installed If it does not work for you, try creating an example game and try again.