当前位置:   article > 正文

AAPT: error: expected reference but got (raw string) #000000 Duplicate class android.support.v4.app_duplicate class android.support.v4.app.inotificati

duplicate class android.support.v4.app.inotificationsidechannel found in mod

出现下面的错误,不用说,一定是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 Stubfoundinmodulescore1.5.0runtime(androidx.core:core:1.5.0)andsupportcompat26.1.0runtime(com.android.support:supportcompat: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 Proxyfoundinmodulescore1.5.0runtime(androidx.core:core:1.5.0)andsupportcompat26.1.0runtime(com.android.support:supportcompat:26.1.0)Duplicateclassandroid.support.v4.os.IResultReceiverfoundinmodulescore1.5.0runtime(androidx.core:core:1.5.0)andsupportcompat26.1.0runtime(com.android.support:supportcompat: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 1foundinmodulescore1.5.0runtime(androidx.core:core:1.5.0)andsupportcompat26.1.0runtime(com.android.support:supportcompat: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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/313042
推荐阅读
相关标签
  

闽ICP备14008679号