Reputation: 87
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.
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.
Upvotes: 4
Views: 8471
Reputation: 11
I solved this by adding this code in project build.gradle
subprojects {
afterEvaluate { project ->
if (project.extensions.findByName("android") != null) {
Integer pluginCompileSdk = project.android.compileSdk
if (pluginCompileSdk != null && pluginCompileSdk < 31) {
project.logger.error( "Warning: Overriding compileSdk version in Flutter plugin: " + project.name + " from " + pluginCompileSdk + " to 31 (to work around https://issuetracker.google.com/issues/199180389)." + "\nIf there is not a new version of " + project.name + ", consider filing an issue against " + project.name + " to increase their compileSdk to the latest (otherwise try updating to the latest version).")
project.android {
compileSdk 31
}
}
}
}
}
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
Upvotes: 0
Reputation: 1223
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
(or latest)
then, run Flutter clean
and Flutter pub get
, and
once again try to create release apk.
Upvotes: 5
Reputation: 571
I have this issue and this package saves me! try it : flutter_keyboard_visibility
Upvotes: 1
Reputation: 61
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
Upvotes: 6
Reputation: 21
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/
Upvotes: 2