After upgrading to Android Studio 3.1, I started to get following error during build. Project uses multidex and DX is enabled by default as you would notice in the error. I
I managed to determine the root cause by using the following steps. It may be different use case for each issue, therefore this is the way to determine the root cause.
include non-project classesandroid.support.v4.accessibilityservice.AccessibilityServiceInfoCompat In my case the issue was ViewPagerIndicator library was downloading support library as jar. Removing it solved the issue.