最近我在构建应用程序时遇到此错误。我没有修改上次成功构建的任何内容。
这是我得到的错误
Android资源链接失败
C:\用户\华硕.gradle\缓存\转换-3\d7936c72110369b4f70374bb97b71a45\已转换\com.谷歌.安卓.gms.base\可绘制-hdpi-v4_common_full_open_on_phone.png.flat:错误:无法读取文件:幻数为0x 929 c1 a24,但AAPT预期为0x 54504141。
错误:解析覆盖失败。
这是我的身材,gradle
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
id 'kotlin-parcelize'
}
android {
namespace 'com.example.amiconnew'
compileSdk 33
defaultConfig {
applicationId "com.example.amiconnew"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
/*CUSTOM LIBRARY*/
// MAPS
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation "com.google.android.gms:play-services-location:20.0.0"
implementation 'com.google.maps.android:android-maps-utils:2.3.0'
//LIVE DATA
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation "androidx.activity:activity-ktx:1.6.0"
//LIFECYCLE SCOPES LIBRARY
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"
implementation 'androidx.datastore:datastore-preferences:1.0.0'
// RETROFIT
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.0"
// MATERIAL DESIGN
implementation "com.google.android.material:material:1.8.0-alpha01"
//NAVIGATION
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
//SWIPE REFRESH LAYOUT
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
}
有人能帮帮我吗?
我已经清理并重建了我的应用程序,我已经重新启动了我的Android Studio,我还更新到了IDE的最后一个版本,但似乎什么都不起作用。
1条答案
按热度按时间blpfk2vs1#
如果您最近更改了命名空间“com.yourcompany.yourappname”,而当前导入到资源的内容“com.yourcompany.your_app_name.R”不匹配,也会导致此错误。
请确保名称空间与导入内容匹配