Flutter Build APK: Failed - Execution failed for task ':keyboard_visibility:verifyReleaseResources'

Viewed 1989

I am facing a strange problem after I have updated flutter or android studio. I was able to run flutter build apk command before. But I can export ipa for iOS version of same application.

I have updated the latest versions of packages. Checked "compilesdkversion 28". Everything looks ok I think.

You can see my failed packages below.

  • keyboard_visibility
  • connectivity

Here is the error output;

FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':keyboard_visibility:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed                                    
     /Users/serkanerkan/.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/fontVariationSettings not found.
                                                                        
     /Users/serkanerkan/.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/ttcIndex not found.
                                                                        
                                                                        
* Try:                                                                  
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                        
* Get more help at https://help.gradle.org                              
                                                                        
BUILD FAILED in 16s                                                     
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                      17.8s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin connectivity...
Running Gradle task 'assembleAarRelease'...                             
Running Gradle task 'assembleAarRelease'... Done                 1,391ms


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'connectivity'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s


The plugin connectivity could not be built due to the issue above.
4 Answers

go to this folder-> C:\flutter.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android Open build.gradle change the compileSdkVersion 27 to compileSdkVersion 28 then flutter clean -> flutter pub get -> flutter build apk --release

Having the same issue here. Fixed by changing the compileSdkVersion located within build.gradle file of the keyboard_visibility plugin set to same as compileSdkVersion with your project. Below link is the reference that I had referred which helped to solve my issue.
https://www.freesion.com/article/1672819994/

I solved this by changing it in Android studio.

Inside project view,

"[project_folder]/external_package/flutter_plugin/[problem_causing_plugin_name]/android/build.gradle/"

Change compileSdkVersion 27 to compileSdkVersion 28

then, run Flutter clean and Flutter pub get, and

once again try to create release apk.

Related