- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我将我的 android studio 更新到版本 3.3 canary 13
(撰写本文时为最新版本)。我被提示更新我的项目的 gradle 版本,我将它更新到版本 3.3.0-alpha13
类路径 'com.android.tools.build:gradle:3.3.0-alpha13'
现在当我尝试运行我的项目时,它因错误而失败
错误:类描述符“Android/support/customtabs/ICustomTabsCallback/;”不能用dex格式表示。
我尝试使缓存无效、清理并重建项目,但没有任何效果。下面是我的应用程序的 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'
}
最佳答案
我决定尝试使用 ./gradlew build --stacktrace
命令,发现 ICustomTabsCallback
类正在被 androidx.browser:browser:1.0.0 使用-rc01
库。
> 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.
然后我使用 ./gradlew app:dependencies
命令查看依赖项是否存在冲突,我发现了错误。
+--- 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 (*)
上面的摘录显示了 debugCompileClasspath
配置的一些依赖关系。我们可以看到 androidx.appcompat:appcompat
包含 androidx.browser:browser
作为传递依赖。
androidx.appcompat:appcompat:1.0.0-rc01 -> 1.0.0
表示将使用版本 1.0.0
而不是版本 1.0。 0-rc01
但 androidx.browser:browser
不是这种情况。将使用版本 1.0.0-rc01
而不是版本 1.0.0
为了解决这个错误,我只是通过在我的应用程序的 build.gradle
configurations {
compile.exclude group: 'androidx.browser', module: 'browser'
}
所以我的应用程序的 build.gradle 看起来像这样
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 {
// ....
}
在那之后,我只是同步、清理并重建了我的项目。
更新
如果答案没有解决您的问题,另一种选择是使用 android studio 稳定版(根据本文编写的 3.2.1)和 gradle 3.2.1 classpath 'com.android.tools.build: gradle:3.2.1'
关于android - 类描述符 'Landroid/support/customtabs/ICustomTabsCallback/;'不能用dex格式表示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52639577/
我收到多行错误,指出它有重复的类 Duplicate class android.support.v4.accessibilityservice.AccessibilityServiceInfoCom
我的项目昨天运行良好,今天却出现以下错误。请帮忙。 出了什么问题:无法解析配置“:app:debugCompileClasspath”的所有文件。 Could not find support-v4.
错误:配置项目“:app”时出现问题。 Could not find support-v4.jar (com.android.support:support-v4:24.0.0). Searched
我正在使用 react-native-webrtc 运行示例应用程序模块。我正在尝试在 android 中运行该应用程序,但出现这样的错误... * What went wrong: A probl
错误:配置项目“:app”时出现问题。 Could not find support-v4.jar (com.android.support:support-v4:24.0.0). Searched
我克隆了我的项目并使用 Android studio 打开,但构建失败并出现以下错误并且同一个项目在其他项目上运行良好。 出了什么问题:无法解析配置“:app:flavorUnsignedReleas
我正在运行示例应用程序......我正在使用 this模块.....但是我收到这样的错误... FAILURE: Build failed with an exception. * What went
我有一个 Ionic 项目,在升级到 OSx Mojave 后,出于某种原因不再构建。 该项目基于 Ionic 3 构建。 我有 Cordova CLI 7.0.0 当我运行时 ionic cordo
我有一个 Ionic 项目,在升级到 OSx Mojave 后,出于某种原因不再构建。 该项目基于 Ionic 3 构建。 我有 Cordova CLI 7.0.0 当我运行时 ionic cordo
添加 Android 平台(ionic cordova platform add android)后,我构建了我的 Ionic 项目(ionic cordova build android),但出现错
这个问题在这里已经有了答案: Manifest merger failed : Attribute application@appComponentFactory - Androidx (14 个答
关于我的 Gradle 文件中的以下“complie”: dependencies { compile 'com.android.support:support-v4:25.3.1' }
有些困惑。 我想更频繁地使用@supports 但是...我不关心浏览器如何看待它。希望您能说清楚,如果可以的话谢谢您。 如果浏览器本身不理解@supports,它如何计算@support 'not'
我刚刚升级到 Dart 2 和最新版本的 Flutter,现在我无法构建我的应用程序。我在互联网上环顾四周,但仍然不明白为什么会发生这种情况。 我得到的错误是: FAILURE: Build fail
我正在学习 Firebase,但由于以下错误而陷入困境: Error:Failed to resolve: com.android.support:customtabs:25.4.0 Error:Fa
我在构建本周时出于某种原因尝试使用Cordova进行项目时遇到问题: cordova build android gradle获取com.android.support:support alpha而不
对应的androidx是什么com.android.support:support-compat 的图书馆实现push notifications ? 他们说here它是 androidx 的一部分,
我正在尝试为我的应用设置插桩单元测试。并且我已根据以下开发者站点链接添加了依赖项。 https://developer.android.com/training/testing/unit-testin
当我想使用 Proguard 规则生成签名的 APK(发布)时,我收到了以下错误消息: Cannot find a version of 'com.android.support:support-an
这个问题在这里已经有了答案: Failed to resolve: com.android.support:appcompat-v7:26.0.0 (14 个答案) Failed to resolv
我是一名优秀的程序员,十分优秀!