Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio build fail with minSDK=29

I have Android Studio build problem.

Build fails only when changing the minSdk=29 with follwing error.
( It's OK with minSdk=28 )

android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.example.aaa"
        minSdkVersion 29  // build fails with 29, it's OK with 28
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

Fail messages on Android Studio build console

    - Build: build failed

       - Run build :

         ...

         Caused by: com.android.tools.r8.utils.AbortException


       - Andriod issues: (1 error)

         Dex file with version '38' cannot be used with min sdk level '29'. 

If anyone resolved this problem, please share your know-hows.

Thank you.

like image 385
teranian Avatar asked Aug 22 '19 02:08

teranian


Video Answer


1 Answers

I came across this recently when updating a project for Android studio 3.5.3 to 3.6.3, however I manually changed gradle-wrapper.properties and the project's build.gradle before even opening the project.

In my case I was able to clean the build, delete the .gradle and .idea folders and rebuild without issue.

Edit: As stated in the comments, it is worthwhile to try a clean-rebuild first, rather than the "Scorched Earth" approach of deleting .gradle and .idea folders. Deleting them will take longer to recover from and blow away all your nice IDE settings!

like image 65
Michael Marsella Avatar answered Sep 19 '22 00:09

Michael Marsella