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

descriptor class python
signature descriptor
com google/protobuf descriptors
no function descriptor found for function
__set__ python
descriptor in programming language

I updated my android studio to version 3.3 canary 13 (latest as of this writing). I was prompted to update my project's gradle version and I updated it to version 3.3.0-alpha13

classpath 'com.android.tools.build:gradle:3.3.0-alpha13'

Now when i tried to run my project, it failed with an error

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

I tried to invalidate cache, clean and rebuild the project but nothing worked. Below is my app's build.gradle

dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha3', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'

}

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'

: Class Descriptor, A Descriptor is a set of mappings that describe how an objects's data is to be represented in a relational database. It contains mappings from the class instance  The class descriptor table (CDT) contains information that directsthe processing of general resources. RACF® referencesthe class descriptor table whenever it receives a resource class nameother than DATASET, USER or GROUP. The class descriptor table has two parts: Thestatic class descriptor table.

If anyone has had this problem with getting AndroidX to work with the Jetifier then you have a couple of options.

If you are able to update your Gradle and plugin version then you should do; this is a bug that was addressed 3.3.0 and above. You can see what combination of gradle/plugin versions you need here; https://developer.android.com/studio/releases/gradle-plugin.

In my case I was tied to Gradle 4.6 and it's highest plugin version of 3.2.1 (i'm using Unity 2017.4 LTS). In which can I applied the workaround found here by adding the following to my build.gradle file;

buildscript {    
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02'
    }
}

Credit to @TheHebrewHammer in the comments above for pointing this one out.

Descriptor (Java Platform SE 7 ), The class names of the exceptions that can be thrown when invoking a constructor or operation, or getting an attribute. The meaning of this field is defined by this  For each field of the class sorted by field name (except private static and private transient fields: The name of the field. The modifiers of the field written as a 32-bit integer. The descriptor of the field. If a class initializer exists, write out the following: The name of the method, <clinit>.

Try changing your theme in your styles.xml so that it extends one of the MaterialComponents theme.

<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">

Other options:

Theme.MaterialComponents
Theme.MaterialComponents.NoActionBar
Theme.MaterialComponents.Light
Theme.MaterialComponents.Light.NoActionBar
Theme.MaterialComponents.Light.DarkActionBar

More about this: https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md

17.7.1 Class Descriptor Objects, 17.7.1 Class Descriptor Objects. The class descriptor objects used as values in the dictionary returned by readmodule() provide the following data members:. public abstract class Descriptor extends java.lang.Object implements java.io.Serializable. This is a base class for entities with USB typed descriptors. It encapsulates raw descriptor data (byte arrays) and provides parsed access to that data.

Class Descriptors, Class Descriptors. The ObjectStreamClass provides information about classes that are saved in a Serialization stream. The descriptor provides the fully-​qualified  In general, a descriptor is an object attribute with “binding behavior”, one whose attribute access has been overridden by methods in the descriptor protocol. Those methods are __get__ (), __set__ (), and __delete__ (). If any of those methods are defined for an object, it is said to be a descriptor.

Descriptor (Javassist API), Converts to a Java class name from a descriptor. static CtClass, toCtClass​(java.​lang.String desc, ClassPool cp). Returns a  Descriptors are a specific Python feature that power a lot of the magic hidden under the language’s hood. If you’ve ever thought that Python descriptors are an advanced topic with few practical applications, then this tutorial is the perfect tool to help you understand this powerful feature.

Getting a Class Descriptor - Java Cookbook [Book], Getting a Class Descriptor Problem You want to get a Class object from a class name or instance. Solution If the class name is known at compile time, you can … Office of the Registrar • 633 Clark Street • Evanston, Illinois 60208-1118 Phone: 847-491-5234 • Fax: 847-491-8458 • E-mail: nu-registrar@northwestern.edu World Wide Web Disclaimer and University Policy Statements

Comments
  • please double check with androidx import . it might be causing the issue
  • @TejasPandya I managed to solve the problem. see answer below
  • That's not a valid solution, if you are actually using customtabs.
  • @Marius I'm not using customtabs. As you can see, it's in the library androidx.browser:browser which is a transitive dependency of androidx.appcompat:appcompat library
  • @AdamHurwitz My app is also connecting to the network and I'm able to make back-end calls. I haven't experienced such kind of error. maybe it's related to something else but I'm glad you found a way out of the problem.
  • @AdamHurwitz I'm going to try the other solution first. I'll let you know if it didn't work and mad a new SO.
  • Like @AdamHurwitz said, this isn't a valid answer as you're removing a transitive dependency which might break the library you're relying on. This is a bug with the AGP 3.3.0-alpha13, see issuetracker.google.com/issues/117145286