Ответ 1
Я исправил эту проблему, выбрав
API 27+: Android API 27, P preview (Предварительный просмотр)
в структуре проекта. Это мои настройки и 13 ошибок, которые я скрыл.
Может кто-нибудь помочь, почему это дает ошибку?
Все работало нормально, и внезапно эта ошибка появляется.
Я googled, но ничего не мог получить! Пожалуйста, помогите
Ошибка: (7, 41) Ресурс не найден, который соответствует указанному имени (at 'dialogCornerRadius' со значением '? android: attr/dialogCornerRadius').
apply plugin: 'com.android.application'
//Add these lines
def Base_URL = '"' + WEBServiceBaseURL + '"' ?: '"Define BASE URL"';
def SMS_Base_URL = '"' + WEBServiceBaseSMSURL + '"' ?: '"Define SMS BASE URL"';
android.buildTypes.each { type ->
type.buildConfigField 'String', 'Base_URL', WEBServiceBaseURL
type.buildConfigField 'String', 'SMS_Base_URL', WEBServiceBaseSMSURL
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.bla.bla"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:+'
compile files('libs/jxl-2.6.jar')
compile 'com.google.gms:google-services:+'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
Я исправил эту проблему, выбрав
API 27+: Android API 27, P preview (Предварительный просмотр)
в структуре проекта. Это мои настройки и 13 ошибок, которые я скрыл.
Измените строку compile 'com.android.support:design:+'
на compile 'com.android.support:design:26.+'
Зависимости gradle при построении проекта сводятся к последним версиям, так как +
говорил ему "получить последнюю версию". 26.+
сообщит процессу сборки только обновление последней версии v26.
Чтобы быть более конкретным и безопасным, измените строку на определенную версию, избегая при этом +
. т.е. compile 'com.android.support:design:27.1.0'
установите compileSdkVersion 28, чтобы загрузить файлы платформы для Android.
После того, как все помогут, я могу решить эту проблему и запустить приложение в более низкой версии.
Мое обновление build.gradle выглядит следующим образом.
Особая благодарность всем гениальным людям!
apply plugin: 'com.android.application'
android.buildTypes.each { type ->
type.buildConfigField 'String', 'Base_URL', WEBServiceBaseURL
type.buildConfigField 'String', 'SMS_Base_URL', WEBServiceBaseSMSURL
}
android {
compileSdkVersion 27
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.dummy.dummy"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.+'
compile files('libs/jxl-2.6.jar')
compile 'com.google.gms:google-services:+'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
забыть о динамических зависимостях и заменить их на фиксированные конкретные версии:
НЕПРАВИЛЬНО:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:+'
compile files('libs/jxl-2.6.jar')
compile 'com.google.gms:google-services:+'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
}
ПРАВИЛЬНО:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.1.0'
compile files('libs/jxl-2.6.jar')
compile 'com.google.gms:google-services:3.1.1'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
}
Измените следующие параметры в своем gradle:
compile 'com.android.support:design:+'
в
compile 'com.android.support:design:26.1.0'
'com.android.support:appcompat-v7:26.+'
в
'com.android.support:appcompat-v7:26.1.0'
Обратите внимание, что вы можете указать любую версию, но убедитесь, что обе они имеют одну и ту же версию.
Это гарантирует, что файл values-28.xml
не будет создан.
если в графе уровня вашего приложения, если вы использовали compileSdkVersion = 27, это не сработает. Вы должны использовать версию 28.
compileSdkVersion 28 buildToolsVersion '28.0.3'