0
votes

I have installed the latest flutter. Create a project using

flutter create --org test test

However it was created using SDK version 29 (default). I believe this is the Android API level

But I need to install my APK in Android 7 (which is API level 24). So I changed the following:

build.gradle
    compileSdkVersion 24
    targetSdkVersion 24

But it failed to build. The error message is:

  • What went wrong: Execution failed for task ':app:processDebugResources'. A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource linking failed C:\Users\User\.gradle\caches\transforms-2\files-2.1\a528b13ac93e64cafa3d0480e2c93207\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontStyle not found.
1
change minSdkVersion to your desired version not compileSdk - Yadu
Thanks @Yadu, but the minSdkVersion is 16. When I try to install, it says This app isn't compatible with your phone - s k
I get my APK from the following location build\app\outputs\apk\debug\app-debug.apk - s k
Android 7 (Nougat)(7.0 – 7.1.2) its api level is 24 – 25. - shirsh shukla
can you debug it in studio? that error states its looking for resource and failed - Yadu

1 Answers

0
votes

I found out the issue. We can only change the targetSdkVersion. compileSdkVersion leave as it is.

build.gradle
    compileSdkVersion 29 <- don't change
    targetSdkVersion 24