Фон
У меня есть проект на моей старой машине, который работает под управлением Android Studio 2.2.2 и Gradle 2.1.4.Теперь у меня есть новый компьютер с последней или более поздней версией Android Studio (3.2) и Gradle 4.3.
В моем первоначальном проекте использовался compilesdkVersion 23 и был интегрирован GCM.Теперь у меня есть новый компьютер, и я хочу обновить свою IDE и зависимости до последней версии, чтобы я мог интегрировать FireBase и использовать разрешения времени выполнения.Я решил сделать все это на новой машине, так как мое программное обеспечение работает на 8000 устройств и не хотел ломать мою производственную сборку.
Проблема
Мой новый проект использует compileSdkVersion 28 и buildToolsVersion '28 .0.0 ', но я получаю следующую ошибку сборки:
Could not find com.android.support:mediarouter:28.0.0.
Searched in the following locations:
file:/C:/Users/MatthewW/AppData/Local/Android/Sdk/extras/m2repository/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.pom
file:/C:/Users/MatthewW/AppData/Local/Android/Sdk/extras/m2repository/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.jar
file:/C:/Users/MatthewW/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.pom
file:/C:/Users/MatthewW/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.jar
file:/C:/Users/MatthewW/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.pom
file:/C:/Users/MatthewW/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.jar
https://repo1.maven.org/maven2/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.pom
https://repo1.maven.org/maven2/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.jar
https://jcenter.bintray.com/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.pom
https://jcenter.bintray.com/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.jar
https://dl.google.com/dl/android/maven2/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.pom
https://dl.google.com/dl/android/maven2/com/android/support/mediarouter/28.0.0/mediarouter-28.0.0.jar
Required by:
project :app
Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager
Я установил репозиторий поддержки Android
Кроме того, в моем файле build.gradle в зависимостях appCompat 28.0.0 подчеркнут красным цветом.При наведении на него указывается, что все библиотеки поддержки Android должны использовать одну и ту же спецификацию версии.я указал 28.0.0, но он обнаружил переходную зависимость 24.0.0 (mediarouter), я уверен, что будут другие.
Чтобы найти все транзитивные зависимости, я следовал за этим сообщением cricket_007:
транзитивные зависимости
Я не могу опубликовать вывод, так как он превышает ограничение в 30000 символов в StackOverflow, но нижеэто исключение, которое показывает, что mediarouter v24.
Executing tasks: [androidDependencies]
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The CompileOptions.bootClasspath property has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the CompileOptions.bootstrapClasspath property instead.
:app:androidDependencies
debug
debugCompileClasspath - Dependencies for compilation
+--- C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\libs\activation.jar
+--- C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\libs\additionnal.jar
+--- C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\libs\core.jar
+--- C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\libs\mail.jar
+--- C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\libs\ndeftools-1.2.3.jar
+--- C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\libs\gcm.jar
+--- com.android.support:design:28.0.0@aar
+--- com.google.android.gms:play-services:9.8.0@aar
+--- com.google.android.gms:play-services-cast-framework:9.8.0@aar
+--- com.google.android.gms:play-services-cast:9.8.0@aar
+--- com.android.support:mediarouter-v7:24.0.0@aar
+--- com.android.support:appcompat-v7:28.0.0@aar
Когда я очищаю проект, я получаю следующее (мне пришлось разделить экран один под другим, как они были маленькими):
На приведенном выше снимке экрана говорится:
org.gradle.tooling.BuildException: Failed to execute aapt
Я читал, что это можетбыть какая-то проблема с ресурсами и длинными именами или специальными символами в имени.
Кто-нибудь есть какие-либо идеи о том, как я могу получить этот проект без ошибок?
[ПРАВИТЬ 1] здесьмой build.gradle
> apply plugin: 'com.android.application'
>
> android {
> compileSdkVersion 28
> buildToolsVersion '28.0.0'
>
>
> useLibrary 'org.apache.http.legacy'
>
> lintOptions {
> checkReleaseBuilds false
> // Or, if you prefer, you can continue to check for errors in release builds,
> // but continue the build even when errors are found:
> abortOnError false
> }
>
> defaultConfig {
> applicationId "com.xxxx"
> minSdkVersion 16
> targetSdkVersion 28
> versionName "5.1"
> setProperty("archivesBaseName", "RR4v$versionName")
> }
>
> buildTypes {
> release {
> minifyEnabled true
> proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
> }
> } }
>
> dependencies {
> compile files('libs/activation.jar')
> compile files('libs/additionnal.jar')
> compile files('libs/core.jar')
> compile files('libs/mail.jar')
> compile files('libs/ndeftools-1.2.3.jar')
> compile files('libs/gcm.jar')
> compile 'com.android.support:appcompat-v7:28.0.0'
> compile 'com.google.android.gms:play-services:9.8.0'
> compile 'joda-time:joda-time:2.1'
> compile 'net.zetetic:android-database-sqlcipher:3.5.6@aar'
> compile 'com.android.support:support-v4:28.0.0'
> compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
> compile 'com.android.support:design:28.0.0'
>
>
> }
[EDIT2]
dependencies {
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/core.jar')
compile files('libs/mail.jar')
compile files('libs/ndeftools-1.2.3.jar')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.gms:play-services:9.8.0'
implementation 'joda-time:joda-time:2.1'
implementation 'net.zetetic:android-database-sqlcipher:3.5.6@aar'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'org.apache.directory.studio:org.apache.commons.io:2.4'
implementation 'com.android.support:design:28.0.0'
[EDIT3]
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3>gradlew clean :app:processDebugResources
> Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The CompileOptions.bootClasspath property has been deprecated and is scheduled to be removed in Gradle 5.0. Please use the CompileOptions.bootstrapClasspath property instead.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\drop_down_list_row.xml:7: AAPT: error: '@+DropDownList/checkbox' is incompatible with attribute id (attr) reference.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\drop_down_list_row.xml:12: AAPT: error: '@+DropDownList/SelectOption' is incompatible with attribute id (attr) reference.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\messagerecipientlayout.xml:15: AAPT: error: '@+DropDownList/SelectBox' is incompatible with attribute id (attr) reference.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\messagerecipientlayout.xml:25: AAPT: error: '@+DropDownList/create' is incompatible with attribute id (attr) reference.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\pop_up_window.xml:9: AAPT: error: '@+DropDownList/dropDownList' is incompatible with attribute id (attr) reference.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\drop_down_list_row.xml:7: error: '@+DropDownList/checkbox' is incompatible with attribute id (attr) reference.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\drop_down_list_row.xml:12: error: '@+DropDownList/SelectOption' is incompatible with attribute id (attr) reference.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\messagerecipientlayout.xml:15: error: '@+DropDownList/SelectBox' is incompatible with attribute id (attr) reference.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\messagerecipientlayout.xml:25: error: '@+DropDownList/create' is incompatible with attribute id (attr) reference.
C:\Users\MatthewW\AndroidStudioProjects\nfcscanner3\app\src\main\res\layout\pop_up_window.xml:9: error: '@+DropDownList/dropDownList' is incompatible with attribute id (attr) reference.
error: failed linking file resources.
> Task :app:processDebugResources FAILED