Class descriptor 'Landroid/support/customtabs/ICustomTabsCallback/;' cannot be represented in dex format

I decided to try ./gradlew build --stacktrace command and saw that ICustomTabsCallback class is being used by androidx.browser:browser:1.0.0-rc01 library.

> Transform browser.aar (androidx.browser:browser:1.0.0-rc01) with DexingTransform
AGPBI: {"kind":"error","text":"Class descriptor \u0027Landroid/support/customtabs/ICustomTabsCallback/;\u0027 cannot be represented in dex format.","sources":[{}],"tool":"D8"}

> Task :app:mergeExtDexDebug FAILED
AGPBI: {"kind":"error","text":"Class descriptor \u0027Landroid/support/customtabs/ICustomTabsCallback/;\u0027 cannot be represented in dex format.","sources":[{}],"tool":"D8"}

FAILURE: Build failed with an exception.

I then used ./gradlew app:dependencies command to see if there is conflict in dependencies and i found the error.

 +--- androidx.appcompat:appcompat:1.0.0-rc01 -> 1.0.0 (*)
|    \--- androidx.browser:browser:1.0.0-rc01
|         +--- androidx.core:core:1.0.0-rc01 -> 1.0.0 (*)
|         +--- androidx.annotation:annotation:1.0.0-rc01 -> 1.0.0
|         +--- androidx.interpolator:interpolator:1.0.0-rc01 -> 1.0.0 (*)
|         +--- androidx.collection:collection:1.0.0-rc01 -> 1.0.0 (*)
|         \--- androidx.legacy:legacy-support-core-ui:1.0.0-rc01 -> 1.0.0 (*)

The above extract shows some of dependencies for debugCompileClasspath configuration. We can see that androidx.appcompat:appcompat contains androidx.browser:browser as a transitive dependency.

androidx.appcompat:appcompat:1.0.0-rc01 -> 1.0.0 means that version 1.0.0 will be used instead of version 1.0.0-rc01 but this is not the case for androidx.browser:browser. version 1.0.0-rc01 will be used instead of version 1.0.0

To solve this error, i just removed the transitive dependencies by adding the below block of code in my app's build.gradle

configurations {
    compile.exclude group: 'androidx.browser', module: 'browser'
}

So my app's build.gradle will look like this

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'

android {
    //....
}

configurations {
    compile.exclude group: 'androidx.browser', module: 'browser'
}

dependencies {
// ....
}

After that, i just synced,cleaned and rebuild my project.

UPDATE

If the answer din't solve your problem, The other option is to use android studio stable version (3.2.1 as per this writing) and gradle 3.2.1 classpath 'com.android.tools.build:gradle:3.2.1'