adee42 / flutter_keyboard_visibility

MIT License
237 stars 143 forks source link

Impossible to build apk on Flutter 1.12.13 #42

Open letsar opened 4 years ago

letsar commented 4 years ago

Hi,

Thanks for your work on this plugin. We upgraded Flutter to the latest stable version (1.12.13+hotfix.5) and while our project can run, it cannot build an apk using

flutter build apk

We have this error:

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/user/.gradle/caches/transforms-2/files-2.1/7faf2ad74a0b9932e38d86e684646e95/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     /Users/user/.gradle/caches/transforms-2/files-2.1/7faf2ad74a0b9932e38d86e684646e95/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

Our projet has been migrated to AndroidX, but the same error appears when I build with the example of this plugin.

Do you know how to resolve this?

alexda12 commented 4 years ago

As a workaround, there is another plugin which is a fork of this plugin called :

flutter_keyboard_visibility: 0.7.0

I've gone over the code and the class names and usage is identical - so it should work out of the box.

You can get around the issue by :

1) Using this plugin 2) Change your gradle class to com.android.tools.build:gradle:3.5.0 3) Change your targetSdkVersion to 28 4) Ensure you reference latest gradle distribution URL : distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 5) Ensure your dependencies do not reference firebase, i.e change

dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test: runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation 'com.google.firebase:firebase-core:16.0.8' }

to

dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test: runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' }

Once all 1-5 is done, Do in order :

1. flutter clean 2. Open pubspec.yaml and just make a simple change and SAVE file 3. flutter pub cache repair

letsar commented 4 years ago

Thanks for the workaround @alexda12. It worked like a charm!

Basher7 commented 4 years ago

As a workaround, there is another plugin which is a fork of this plugin called :

flutter_keyboard_visibility: 0.7.0

I've gone over the code and the class names and usage is identical - so it should work out of the box.

You can get around the issue by :

  1. Using this plugin
  2. Change your gradle class to com.android.tools.build:gradle:3.5.0
  3. Change your targetSdkVersion to 28
  4. Ensure you reference latest gradle distribution URL : distributionUrl=https://services.gradle.org/distributions/gradle-5.6.2-all.zip
  5. Ensure your dependencies do not reference firebase, i.e change

dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test: runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation 'com.google.firebase:firebase-core:16.0.8' }

to

dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test: runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' }

Once all 1-5 is done, Do in order :

1. flutter clean 2. Open pubspec.yaml and just make a simple change and SAVE file 3. flutter pub cache repair

After following above procedure, throw another error when I run flutter build apk

D:\Development\Node JS\XpertMemos\XpertMemo_flutter>flutter build apk You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64. If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size. To generate an app bundle, run: flutter build appbundle --target-platform android-arm,android-arm64,android-x64 Learn more on: https://developer.android.com/guide/app-bundle To split the APKs per ABI, run: flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split Running Gradle task 'assembleRelease'...
Note: D:\Development\FlutterSDK\flutter.pub-cache\hosted\pub.dartlang.org\connectivity-0.4.3+6\android\src\main\java\io\flutter\plugins\connectivity\ConnectivityPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Note: D:\Development\FlutterSDK\flutter.pub-cache\hosted\pub.dartlang.org\permission_handler-3.3.0\android\src\main\java\com\baseflow\permissionhandler\PermissionHandlerPlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: D:\Development\FlutterSDK\flutter.pub-cache\hosted\pub.dartlang.org\share-0.6.3+1\android\src\main\java\io\flutter\plugins\share\SharePlugin.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: D:\Development\FlutterSDK\flutter.pub-cache\hosted\pub.dartlang.org\url_launcher-5.1.3\android\src\main\java\io\flutter\plugins\urllauncher\WebViewActivity.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. D:\Development\Node JS\XpertMemos\XpertMemo_flutter\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:16: error: a type with the same simple name is already defined by the single-type-import of KeyboardVisibilityPlugin import com.github.adee42.keyboardvisibility.KeyboardVisibilityPlugin; ^ 1 error

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileReleaseJavaWithJavac'.

    Compilation failed; see the compiler error output for details.

  • 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 4m 29s Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 270.4s (!) Gradle task assembleRelease failed with exit code 1

pubspec.yaml file

dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.2 sqflite: 1.1.7+2 path_provider: 0.5.0+1 http: 0.12.0+2 connectivity: 0.4.3+6 font_awesome_flutter: 8.5.0 flutter_sparkline: any flutter_staggered_grid_view: 0.3.0 intl: ^0.15.8 datetime_picker_formfield: ^0.4.3 qr_flutter: ^3.0.1 flutter_typeahead : 1.6.1
permission_handler: 3.3.0 encrypt: 1.0.1 loader_search_bar: any url_launcher : any geolocator: 5.1.5 file_picker: ^1.4.3+1 image_picker: ^0.6.1+4 progress_indicators: any mime: ^0.9.6+2 fluttertoast: ^3.1.0 pdf: ^1.3.11 printing: ^2.1.3 flutter_local_notifications: 0.7.1+3 image: 2.1.4 flutter_image_compress: ^0.6.3 carousel_slider: ^1.3.0 random_string: ^0.0.2 dio: 2.1.0 file_utils: ^0.1.3 translator: ^0.1.2 photo_view: 0.4.2 flutter_webrtc: 0.1.7 shared_preferences: any auto_size_text: ^2.1.0 firebase_messaging: ^5.1.2 workmanager: ^0.1.2 flutter_barcode_scanner: ^0.1.5+1 progress_dialog: ^1.1.0+1 archive: ^2.0.10 charts_flutter: ^0.8.1 flutter_vector_icons: ^0.2.1 flutter_google_places: ^0.2.3 share: ^0.6.3+1 flutter_keyboard_visibility: ^0.7.0

android\build.gradle file

dependencies { classpath 'com.android.tools.build:gradle:3.5.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath 'com.google.gms:google-services:4.2.0' }

targetSdkVersion already 28 android\app\build.gradle file

dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test: runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' }

Basher7 commented 4 years ago

I have still facing this error

C:\Users\XPERT_005\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.6\android\src\main\java\io\flutter\plugins\sharedpreferences\SharedPreferencesPlugin.java:25: warning: [deprecation] getFlutterEngine() in FlutterPluginBinding has been deprecated setupChannel(binding.getFlutterEngine().getDartExecutor(), binding.getApplicationContext()); ^ 1 warning Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':keyboard_visibility:verifyReleaseResources'.

    java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
    D:\Development\Node JS\XpertMemos\XpertMemo_flutter\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: error: resource android:attr/fontVariationSettings not found. D:\Development\Node JS\XpertMemos\XpertMemo_flutter\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: error: resource android:attr/ttcIndex not found. error: failed linking references.

  • 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 4m 26s Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 267.8s (!) Gradle task assembleRelease failed with exit code 1

I also follow this steps. click here to see that post

adrianvintu commented 4 years ago

How I fixed it, from your text.

My error was

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. The keyboard_visibility sticks out 3 times, so I went in my .dart files and found import 'package:keyboard_visibility/keyboard_visibility.dart';

  2. I clicked on keyboard_visibility.dart so it takes me to the source - it appears north in Visual Studio Code - path was: c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart

  3. I then went to c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle changed compileSdkVersion 27 to compileSdkVersion 28 and voila, it works!

It = running this flutter build apk --release

Basher7 commented 4 years ago

many many thanks brother, @adrianvintu . finaly solved this issue

majdkz97 commented 4 years ago

How I fixed it, from your text.

My error was

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. The keyboard_visibility sticks out 3 times, so I went in my .dart files and found import 'package:keyboard_visibility/keyboard_visibility.dart';
  2. I clicked on keyboard_visibility.dart so it takes me to the source - it appears north in Visual Studio Code - path was: c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart
  3. I then went to c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle changed compileSdkVersion 27 to compileSdkVersion 28 and voila, it works!

It = running this flutter build apk --release

Yes It's Work

bravekingzhang commented 4 years ago

@adrianvintu you safe mine ton of time

marco2250 commented 4 years ago

@adrianvintu Thank you!

ghost commented 4 years ago

I run into the same problem but found a better solution without hacking https://stackoverflow.com/a/25736483/1016472

LeDuyTho commented 4 years ago

Solved:

incepio-flutter commented 4 years ago

How I fixed it, from your text.

My error was

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. The keyboard_visibility sticks out 3 times, so I went in my .dart files and found import 'package:keyboard_visibility/keyboard_visibility.dart';
  2. I clicked on keyboard_visibility.dart so it takes me to the source - it appears north in Visual Studio Code - path was: c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart
  3. I then went to c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle changed compileSdkVersion 27 to compileSdkVersion 28 and voila, it works!

It = running this flutter build apk --release

I have same error cn you help me solve it ?

HarrisonQi commented 4 years ago

3. keyboard_visibility-0.5.6

my Path is not same as yours, mine is in D:\flutter\.pub-cache\hosted\pub.flutter-io.cn\keyboard_visibility-0.5.6\android

cddsgtc commented 4 years ago

@adrianvintu yes, it works.

lavahasif commented 4 years ago

@alexda12 worked thanks

chenenyu commented 4 years ago

I find two ways to resolve this problem:

  1. Add a flavor
  2. run ./gradlw :app:assembleRelease instead of ./gradlew assembleRelease in android folder.

But i don't know why it does work. 😢

lourencosjr commented 4 years ago

Como eu o consertei, no seu texto. Meu erro foi

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. As keyboard_visibilityvaras se destacam três vezes, então eu fui nos meus arquivos .dart e encontrei import 'package:keyboard_visibility/keyboard_visibility.dart';
  2. Cliquei keyboard_visibility.dartpara que ele me leve à fonte - aparece ao norte no Código do Visual Studio - o caminho era:c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart
  3. Depois fui c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle compileSdkVersion 27 para compileSdkVersion 28 e pronto, funciona!

It = executando isso flutter build apk --release

Sim, é trabalho

it really works. in my case C:\Users\loure\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle

from: android {      compileSdkVersion 27 ...

for: android {      compileSdkVersion 28 ...

thank you very much

tzvc commented 4 years ago

Any updates on this? Is there any better way to do solve this than this workaround?

zjy886 commented 4 years ago

I have still facing this error

C:\Users\XPERT_005\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.6\android\src\main\java\io\flutter\plugins\sharedpreferences\SharedPreferencesPlugin.java:25: warning: [deprecation] getFlutterEngine() in FlutterPluginBinding has been deprecated setupChannel(binding.getFlutterEngine().getDartExecutor(), binding.getApplicationContext()); ^ 1 warning Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':keyboard_visibility:verifyReleaseResources'.

java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed D:\Development\Node JS\XpertMemos\XpertMemo_flutter\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: error: resource android:attr/fontVariationSettings not found. D:\Development\Node JS\XpertMemos\XpertMemo_flutter\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: error: resource android:attr/ttcIndex not found. error: failed linking references.

  • 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 4m 26s Running Gradle task 'assembleRelease'... Running Gradle task 'assembleRelease'... Done 267.8s (!) Gradle task assembleRelease failed with exit code 1

I also follow this steps. click here to see that post

How did you resolve this error? I have the same error

filippo-orru commented 4 years ago

@zjy886 Look in the posts below, I migrated to flutter_keyboard_visibility and changed just two lines of code. Works fine now. Look at what @alexda12 wrote

Gabriel-Aquino commented 4 years ago

Como eu o consertei, no seu texto.

Meu erro foi

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. As keyboard_visibilityvaras se destacam três vezes, então eu fui nos meus arquivos .dart e encontrei import 'package:keyboard_visibility/keyboard_visibility.dart';
  2. Cliquei keyboard_visibility.dartpara que ele me leve à fonte - aparece ao norte no Código do Visual Studio - o caminho era:c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart
  3. Fui então c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle alterado compileSdkVersion 27 para compileSdkVersion 28 e pronto, ele funciona!

It = executando isso flutter build apk --release

it's worked to me when proximity_plugin on flutter doesn't worked. I changed the sdk version on build.gradle of the plugin above. Thank You!!!

salusou commented 4 years ago

How I fixed it, from your text.

My error was

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. The keyboard_visibility sticks out 3 times, so I went in my .dart files and found import 'package:keyboard_visibility/keyboard_visibility.dart';
  2. I clicked on keyboard_visibility.dart so it takes me to the source - it appears north in Visual Studio Code - path was: c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart
  3. I then went to c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle changed compileSdkVersion 27 to compileSdkVersion 28 and voila, it works!

It = running this flutter build apk --release

It's works for me. Thanks

michcio53 commented 4 years ago

Sooo... Will the creators finally bump up compileSdkVersion of this app, so that we don't have to remember that?

MisterJimson commented 4 years ago

I have property updated the package and bumped compile version here: https://github.com/MisterJimson/flutter_keyboard_visibility

soxjke commented 4 years ago

I run into the same problem but found a better solution without hacking https://stackoverflow.com/a/25736483/1016472

After fighting for few hours and digging a ton of internet I'm really looking for a way to broadcast this to the world. This is the most correct solution so far, without doing magic of digging into each and every of particular flutter plugins with old versions in build.gradle.

Thanks, man!

Dhar15 commented 4 years ago

After a lot of searching I finally reached the pub.dartlang.org folder only to find there is no keyboard-visibility package there. Any clue?

MisterJimson commented 4 years ago

@Dhar15 I suggest using my updated fork: https://pub.dev/packages/flutter_keyboard_visibility

mrtampan commented 4 years ago

How I fixed it, from your text.

My error was

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. The keyboard_visibility sticks out 3 times, so I went in my .dart files and found import 'package:keyboard_visibility/keyboard_visibility.dart';
  2. I clicked on keyboard_visibility.dart so it takes me to the source - it appears north in Visual Studio Code - path was: c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart
  3. I then went to c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle changed compileSdkVersion 27 to compileSdkVersion 28 and voila, it works!

It = running this flutter build apk --release

thank you mass broo.

Abhishek01039 commented 4 years ago

Hi @letsar have you solved your issue with the latest version of flutter? Thanks.

antzkeren commented 4 years ago

How I fixed it, from your text.

My error was

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. The keyboard_visibility sticks out 3 times, so I went in my .dart files and found import 'package:keyboard_visibility/keyboard_visibility.dart';
  2. I clicked on keyboard_visibility.dart so it takes me to the source - it appears north in Visual Studio Code - path was: c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart
  3. I then went to c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle changed compileSdkVersion 27 to compileSdkVersion 28 and voila, it works!

It = running this flutter build apk --release

It Works !! Thanks a lot for very detail steps.

yberant commented 3 years ago

As a workaround, there is another plugin which is a fork of this plugin called :

flutter_keyboard_visibility: 0.7.0

I've gone over the code and the class names and usage is identical - so it should work out of the box.

You can get around the issue by :

  1. Using this plugin
  2. Change your gradle class to com.android.tools.build:gradle:3.5.0
  3. Change your targetSdkVersion to 28
  4. Ensure you reference latest gradle distribution URL : distributionUrl=https://services.gradle.org/distributions/gradle-5.6.2-all.zip
  5. Ensure your dependencies do not reference firebase, i.e change

dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test: runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' implementation 'com.google.firebase:firebase-core:16.0.8' }

to

dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test: runner:1.1.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' }

Once all 1-5 is done, Do in order :

1. flutter clean 2. Open pubspec.yaml and just make a simple change and SAVE file 3. flutter pub cache repair

It worked! Thank you, I owe you my life

nimi0112 commented 3 years ago

For those facing problem, I have deployed a fix at https://github.com/nimi0112/flutter_keyboard_visibility and it can be used as

keyboard_visibility:
    git:
      url: "https://github.com/nimi0112/flutter_keyboard_visibility.git"

Please use this and ⭐ the repo.

I have also raised PR https://github.com/adee42/flutter_keyboard_visibility/pull/69 but the repo is inactive now.

MisterJimson commented 3 years ago

For months now I have been maintaining this fork. It also has a bunch of other fixes and features: https://pub.dev/packages/flutter_keyboard_visibility

ventr1x commented 3 years ago

How is this a fork? It doesn't even include "KeyboardVisibilityNotification().addNewListener" anymore.

MisterJimson commented 3 years ago

@ventr1x its been a while since it was forked and we have updated the API based on feedback. The replacement call for that would be something like this:

import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';

@override
void initState() {
  super.initState();

  var keyboardVisibilityController = KeyboardVisibilityController();
  // Query
  print('Keyboard visibility direct query: ${keyboardVisibilityController.isVisible}');

  // Subscribe
  keyboardVisibilityController.onChange.listen((bool visible) {
    print('Keyboard visibility update. Is visible: ${visible}');
  });
}
saurabhkumar8112 commented 3 years ago
Update compileSdkVersion and targetSdkVersion to 31

And add this code snippet in your android/build.gradle file at the very end.

 configurations.all {
        resolutionStrategy {
            force 'androidx.core:core-ktx:1.6.0'
        }
    }
antonio-pedro99 commented 2 years ago

Sooo... Will the creators finally bump up compileSdkVersion of this app, so that we don't have to remember that?

I think they cannot. Because every project will not have the same compileSdkVersion.

shubhamranswal commented 1 year ago

How I fixed it, from your text.

My error was

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. The keyboard_visibility sticks out 3 times, so I went in my .dart files and found import 'package:keyboard_visibility/keyboard_visibility.dart';
  2. I clicked on keyboard_visibility.dart so it takes me to the source - it appears north in Visual Studio Code - path was: c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart
  3. I then went to c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle changed compileSdkVersion 27 to compileSdkVersion 28 and voila, it works!

It = running this flutter build apk --release

It actually worked for me tooo... Just make the compileSdkVersion the same to that of your project. It will work absolutely fine then.

iHamza7 commented 3 weeks ago

How I fixed it, from your text.

My error was

* 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
     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:236: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\a_progra\hg\flutter\the_wind_method\build\keyboard_visibility\intermediates\res\merged\release\values\values.xml:237: AAPT: error: resource android:attr/ttcIndex not found.
  1. The keyboard_visibility sticks out 3 times, so I went in my .dart files and found import 'package:keyboard_visibility/keyboard_visibility.dart';
  2. I clicked on keyboard_visibility.dart so it takes me to the source - it appears north in Visual Studio Code - path was: c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\lib\keyboard_visibility.dart
  3. I then went to c:\flutter\.pub-cache\hosted\pub.dartlang.org\keyboard_visibility-0.5.6\android\build.gradle changed compileSdkVersion 27 to compileSdkVersion 28 and voila, it works!

It = running this flutter build apk --release

life saving