Не удается создать приложение на Android. Множественные ошибки компоновки

#android #react-native #android-studio #gradle

#Android #react-native #android-studio #gradle

Вопрос:

при сборке моего приложения в Android studio я получаю следующую ошибку:

 > Task :app:processDebugResources FAILED
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml","position":{"startLine":527,"startColumn":4,"startOffset":39038,"endLine":592,"endColumn":10,"endOffset":43834}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml:528:5-593:11: AAPT: error: style attribute 'android:attr/contextPopupMenuStyle' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml","position":{"startLine":641,"startColumn":4,"startOffset":46880,"endLine":698,"endColumn":10,"endOffset":51129}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml:642:5-699:11: AAPT: error: style attribute 'android:attr/contextPopupMenuStyle' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml","position":{"startLine":747,"startColumn":4,"startOffset":54189,"endLine":811,"endColumn":10,"endOffset":58892}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml:748:5-812:11: AAPT: error: style attribute 'android:attr/contextPopupMenuStyle' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml","position":{"startLine":908,"startColumn":4,"startOffset":64921,"endLine":965,"endColumn":10,"endOffset":69086}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml:909:5-966:11: AAPT: error: style attribute 'android:attr/contextPopupMenuStyle' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml","position":{"startLine":1022,"startColumn":4,"startOffset":72626,"endLine":1033,"endColumn":10,"endOffset":73681}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml:1023:5-1034:11: AAPT: error: style attribute 'android:attr/dialogCornerRadius' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v26/values-v26.xml","position":{"startLine":4,"startColumn":4,"startOffset":217,"endLine":7,"endColumn":12,"endOffset":426}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v26/values-v26.xml:5:5-8:13: AAPT: error: resource android:attr/colorError not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v26/values-v26.xml","position":{"startLine":8,"startColumn":4,"startOffset":431,"endLine":11,"endColumn":12,"endOffset":652}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v26/values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v26/values-v26.xml","position":{"startLine":12,"startColumn":4,"startOffset":657,"endLine":15,"endColumn":12,"endOffset":891}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v26/values-v26.xml:13:5-16:13: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v28/values-v28.xml","position":{"startLine":4,"startColumn":4,"startOffset":217,"endLine":7,"endColumn":12,"endOffset":442}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v28/values-v28.xml:5:5-8:13: AAPT: error: resource android:attr/dialogCornerRadius not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v28/values-v28.xml","position":{"startLine":8,"startColumn":4,"startOffset":447,"endLine":11,"endColumn":12,"endOffset":684}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v23/values-v23.xml","position":{"startLine":37,"startColumn":4,"startOffset":2618,"endLine":40,"endColumn":12,"endOffset":2837}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v23/values-v23.xml:38:5-41:13: AAPT: error: style attribute 'android:attr/hyphenationFrequency' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v23/values-v23.xml","position":{"startLine":37,"startColumn":4,"startOffset":2618,"endLine":40,"endColumn":12,"endOffset":2837}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v23/values-v23.xml:38:5-41:13: AAPT: error: style attribute 'android:attr/breakStrategy' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v23/values-v23.xml","position":{"startLine":44,"startColumn":4,"startOffset":3177,"endLine":47,"endColumn":12,"endOffset":3402}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v23/values-v23.xml:45:5-48:13: AAPT: error: style attribute 'android:attr/hyphenationFrequency' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v23/values-v23.xml","position":{"startLine":44,"startColumn":4,"startOffset":3177,"endLine":47,"endColumn":12,"endOffset":3402}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/102f4e5339e61a836806a4922c0ccf33/appcompat-1.1.0/res/values-v23/values-v23.xml:45:5-48:13: AAPT: error: style attribute 'android:attr/breakStrategy' not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/cb98cb7aa050aadd68368dde2f298c4f/cardview-1.0.0/res/values-v23/values-v23.xml","position":{"startLine":2,"startColumn":4,"startOffset":55,"endLine":4,"endColumn":12,"endOffset":200}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/cb98cb7aa050aadd68368dde2f298c4f/cardview-1.0.0/res/values-v23/values-v23.xml:3:5-5:13: AAPT: error: resource android:attr/colorBackgroundFloating not found.n    ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml","position":{"startLine":1708,"startColumn":4,"startOffset":117184,"endLine":1715,"endColumn":10,"endOffset":117611}}],"original":"/Users/prikshetsharma/.gradle/caches/transforms-2/files-2.1/a72fc6914174c60e99bb51c1d98759b9/material-1.1.0/res/values/values.xml:1709:5-1716:11: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.n    ","tool":"AAPT"}


 

Я также пробовал https://github.com/facebook/react-native/issues/30815 , но все равно получаю ту же ошибку. Как это исправить?

Комментарии:

1. Вы пытались синхронизировать свой проект Gradle? Когда вы открываете меню gradle на правой боковой панели Android Studio, вы можете загрузить все файлы gradle с помощью кнопки «перезагрузить проект gradle»

2. не могли бы вы предоставить ссылку на свой проект на github?

3. @Anatolii нет, извините.

4. @zendevil.eth вам удалось исправить эту ошибку?

Ответ №1:

Попробуйте, очистив Gradle проекта.

Выполните следующую команду:

 cd android
rm -rf android/.gradle
rm -rf .gradle
rm -rf ~/.gradle
./gradlew clean
 

Комментарии:

1. Получение той же ошибки после выполнения этого

2. Пожалуйста, попробуйте еще раз, я обновил свой ответ.

3. ./gradlew clean выдает: zsh: нет такого файла или каталога: ./gradlew

4. Я забыл перейти к каталогу Android, пожалуйста, повторите попытку, я обновил свой ответ

5. после выполнения шагов по-прежнему появляется та же ошибка

Ответ №2:

Перейдите в папку Android и запустите ./gradlew clean

Удалить папку caches из /Users/prikshetsharma/.gradle/caches/

И перейдите к android/gradle/wrapper/gradle-wrappers.properties и замените distrubution url на 6.3 вместо 6.2 следующим образом,

 distributionUrl=https://services.gradle.org/distributions/gradle-6.3-all.zip
 

ПРИМЕЧАНИЕ: проверьте targetSdkVersion в build.gradle , оно должно быть больше 26.

Ответ №3:

Ошибка связана с тем, что вы наследуете неправильную тему styles.xml . Убедитесь, что вы используете правильную тему приложения. Я не могу показать вам точный код, который вы видите в вашем сообщении, но это проблема, которую я вижу.