Running Android Studio 3.2 RC3. Tried upgrading an old project to use androidx
. Got most of it working, but I keep getting the error below.
java.lang.RuntimeException: com.android.build.api.transform.TransformException: Error while generating the main dex list. com.android.build.api.transform.TransformException: Error while generating the main dex list. com.android.builder.multidex.D8MainDexList$MainDexListException: com.android.tools.r8.errors.CompilationError: Program type already present: android.support.v4.media.MediaBrowserCompat$CallbackHandler
com.android.tools.r8.errors.CompilationError: Program type already present: android.support.v4.media.MediaBrowserCompat$CallbackHandler
I have these properties set in gradle.properties
:
android.useAndroidX=true
# Tried both false and true...
android.enableJetifier=false
The following line in my app.gradle
seems to be the culprit:
implementation 'androidx.mediarouter:mediarouter:1.0.0'
Obviously, I need the classes from that library so I can't remove it.
Update
External libraries shows this suspicious dependency:
Gradle: androidx.media:media-1.0.0
classes.jar
android.support.v4.media
MediaBrowserCompat
MediaBrowserCompatApi21
MediaBrowserCompatApi23
MediaBrowserCompatApi26
Why this dependency?