Студия Android показывает ошибки в каждой строке, связанной с поддержкой библиотеки. И при перестройке проекта говорится:
Не удалось связать ресурс Android.
Я попробовал следующее:
чистый/восстановление
Invaidate кэши/перезагрузка
Удалить/переустановить Android Studio
Мой build.gradle (приложение) выглядит следующим образом:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.androphobia.fyp.spreadknowledge"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '28.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.google.firebase:firebase-firestore:18.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
}
apply plugin: 'com.google.gms.google-services'
styles.xml выглядит следующим образом:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorAccent">@color/white</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
Проблема связана с CircleImageView версии и вашего проекта.
В вашем проекте ваша библиотека поддержки версии 28.0.0 (pre-androidx
) и CircleImageView version 3
которая работает под управлением версии androidx.
поэтому вы должны обновить свой проект androidx или понизить версию circleImageView до 2.x
1. Close the Android Studio
2. Delete the .AndroidStudio3.3 folder from File System
3. start Android Studio after that .AndroidStudio3.3 Folder Recreated Automaticall then
Your Error will be solved
Переход на Android-X решил проблему.
Идти к:
Рефакторинг → Переход на AndroidX
понизьте до 27 и проверьте, или установлен SDK 28
удалить эти две зависимости,
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-compat:28.0.0'
Пожалуйста, попробуйте добавить эту зависимость здесь:
implementation "com.android.support:support-core-utils:28.0.0"