Android Studio Gradle Build failed - request for sdk version that does not exist

24 hours ago my project was built perfectly, no errors. Without changing one piece of code, it will no longer work when I resume work. As a result of checking previous work commits, the same error occurs.

These are the error codes I get:

Information:Gradle tasks [assemble] Error:(9, 5) error: resource android:attr/dialogCornerRadius not found. /home/liam/.gradle/caches/transforms-1/files-1.1/appcompat-v7-28.0.0-alpha1.aar/536e4dd78846259cf8bef0fd6a3ea0e6/res/values/values.xml 

I think this was caused by the release of Android P, and my Android Studio automatically updated, or something like that. This explains why the old commits that worked get the same error. This will be a very new problem that explains why I can’t find a solution yet.

Finding these error codes leads to a similar problem that was resolved by changing the SDK version in the gradle build file. My problem is different from this, because switching to SDK 28 (I'm sure 28 does not even exist) leads to android studio saying that this package is not available / does not exist for download.

How to find Android SDK 3.0 problem Error: (9, 5) error: android resource: attr / colorError not found

Clicking on the first mentioned error codes leads to opening a file with the name v28 / values-v28.xml.

 <?xml version="1.0" encoding="utf-8"?> <resources> <style name="Base.Theme.AppCompat" parent="Base.V28.Theme.AppCompat"/> <style name="Base.Theme.AppCompat.Light" parent="Base.V28.Theme.AppCompat.Light"/> <style name="Base.V28.Theme.AppCompat" parent="Base.V26.Theme.AppCompat"> <!-- We can use the platform styles on API 28+ --> <item name="dialogCornerRadius">?android:attr/dialogCornerRadius</item> </style> <style name="Base.V28.Theme.AppCompat.Light" parent="Base.V26.Theme.AppCompat.Light"> <!-- We can use the platform styles on API 28+ --> <item name="dialogCornerRadius">?android:attr/dialogCornerRadius</item> </style> </resources> 

Here are my gradle files:

 apply plugin: 'com.android.application' android { compileSdkVersion 26 defaultConfig { applicationId "com.timelord.timelord.timelord" minSdkVersion 24 targetSdkVersion 26 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support:design:+' implementation 'com.android.support.constraint:constraint-layout:1.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' implementation files('libs/joda-time-2.9.9.jar') } 

and

 // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } 
+5
source share
2 answers

You have a version of the lib design with + in your build.gradle, which means that it will download the latest version. Therefore, please set it to 26.1.0 and it should work. Support 28 is in alpha and was released yesterday with the new android P preview

+8
source

Make sure in your build.gradle application you have:

 dependencies { compile 'com.android.support:support-v13:27.+' compile 'com.android.support:design:27.+' } 
+1
source

Source: https://habr.com/ru/post/1275785/


All Articles