IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 移动开发 -> AAPT: error: expected reference but got (raw string) #000000 Duplicate class android.support.v4.app -> 正文阅读

[移动开发]AAPT: error: expected reference but got (raw string) #000000 Duplicate class android.support.v4.app

出现下面的错误,不用说,一定是android studio 配置的问题:
as settings.gradle 配置如下:
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
maven { url ‘https://jitpack.io’ }
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url ‘https://jitpack.io’ }
}
}
rootProject.name = “Tuya”
include ‘:app’

app 依赖如下:
implementation ‘androidx.appcompat:appcompat:1.3.0’
implementation ‘com.google.android.material:material:1.4.0’
implementation ‘androidx.constraintlayout:constraintlayout:2.0.4’
testImplementation ‘junit:junit:4.13.2’
androidTestImplementation ‘androidx.test.ext:junit:1.1.3’
androidTestImplementation ‘androidx.test.espresso:espresso-core:3.4.0’

根gradle如下:
plugins {
id ‘com.android.application’ version ‘7.1.1’ apply false
id ‘com.android.library’ version ‘7.1.1’ apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
}

报错如下:

ERROR:C:\Users\Administrator.gradle\caches\transforms-3\7b483ed8cace7cbeb68210ec22e9d57d\transformed\coordinatorlayout-1.1.0\res\values\values.xml: AAPT: error: expected reference but got (raw string) #000000.

Duplicate class android.support.v4.app.INotificationSideChannel found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.app.INotificationSideChannel S t u b f o u n d i n m o d u l e s c o r e ? 1.5.0 ? r u n t i m e ( a n d r o i d x . c o r e : c o r e : 1.5.0 ) a n d s u p p o r t ? c o m p a t ? 26.1.0 ? r u n t i m e ( c o m . a n d r o i d . s u p p o r t : s u p p o r t ? c o m p a t : 26.1.0 ) D u p l i c a t e c l a s s a n d r o i d . s u p p o r t . v 4. a p p . I N o t i f i c a t i o n S i d e C h a n n e l Stub found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0) Duplicate class android.support.v4.app.INotificationSideChannel Stubfoundinmodulescore?1.5.0?runtime(androidx.core:core:1.5.0)andsupport?compat?26.1.0?runtime(com.android.support:support?compat:26.1.0)Duplicateclassandroid.support.v4.app.INotificationSideChannelStub P r o x y f o u n d i n m o d u l e s c o r e ? 1.5.0 ? r u n t i m e ( a n d r o i d x . c o r e : c o r e : 1.5.0 ) a n d s u p p o r t ? c o m p a t ? 26.1.0 ? r u n t i m e ( c o m . a n d r o i d . s u p p o r t : s u p p o r t ? c o m p a t : 26.1.0 ) D u p l i c a t e c l a s s a n d r o i d . s u p p o r t . v 4. o s . I R e s u l t R e c e i v e r f o u n d i n m o d u l e s c o r e ? 1.5.0 ? r u n t i m e ( a n d r o i d x . c o r e : c o r e : 1.5.0 ) a n d s u p p o r t ? c o m p a t ? 26.1.0 ? r u n t i m e ( c o m . a n d r o i d . s u p p o r t : s u p p o r t ? c o m p a t : 26.1.0 ) D u p l i c a t e c l a s s a n d r o i d . s u p p o r t . v 4. o s . I R e s u l t R e c e i v e r Proxy found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0) Duplicate class android.support.v4.os.IResultReceiver found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0) Duplicate class android.support.v4.os.IResultReceiver Proxyfoundinmodulescore?1.5.0?runtime(androidx.core:core:1.5.0)andsupport?compat?26.1.0?runtime(com.android.support:support?compat:26.1.0)Duplicateclassandroid.support.v4.os.IResultReceiverfoundinmodulescore?1.5.0?runtime(androidx.core:core:1.5.0)andsupport?compat?26.1.0?runtime(com.android.support:support?compat:26.1.0)Duplicateclassandroid.support.v4.os.IResultReceiverStub found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.IResultReceiver S t u b Stub StubProxy found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver 1 f o u n d i n m o d u l e s c o r e ? 1.5.0 ? r u n t i m e ( a n d r o i d x . c o r e : c o r e : 1.5.0 ) a n d s u p p o r t ? c o m p a t ? 26.1.0 ? r u n t i m e ( c o m . a n d r o i d . s u p p o r t : s u p p o r t ? c o m p a t : 26.1.0 ) D u p l i c a t e c l a s s a n d r o i d . s u p p o r t . v 4. o s . R e s u l t R e c e i v e r 1 found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0) Duplicate class android.support.v4.os.ResultReceiver 1foundinmodulescore?1.5.0?runtime(androidx.core:core:1.5.0)andsupport?compat?26.1.0?runtime(com.android.support:support?compat:26.1.0)Duplicateclassandroid.support.v4.os.ResultReceiverMyResultReceiver found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)
Duplicate class android.support.v4.os.ResultReceiver$MyRunnable found in modules core-1.5.0-runtime (androidx.core:core:1.5.0) and support-compat-26.1.0-runtime (com.android.support:support-compat:26.1.0)

Go to the documentation to learn how to Fix dependency resolution errors.

处理方法:

需要在gradle.properties中添加下面两行代码

这是因为混合支持库。通过添加这些行选择androidX作为您的支持库

android.useAndroidX=true
android.enableJetifier=true

参考链接:
https://blog.csdn.net/mawei7510/article/details/91955490
https://stackoverflow.com/questions/68600217/android-studio-error-saying-aapt-error-expected-dimension-but-got-raw-string

  移动开发 最新文章
Vue3装载axios和element-ui
android adb cmd
【xcode】Xcode常用快捷键与技巧
Android开发中的线程池使用
Java 和 Android 的 Base64
Android 测试文字编码格式
微信小程序支付
安卓权限记录
知乎之自动养号
【Android Jetpack】DataStore
上一篇文章      下一篇文章      查看所有文章
加:2022-03-13 21:56:51  更:2022-03-13 21:58:50 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年10日历 -2024/10/26 14:26:30-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码