adee42 / flutter_keyboard_visibility

MIT License
237 stars 143 forks source link

Execution failed for task ':keyboard_visibility:verifyReleaseResources'. when release build #64

Open rollrat opened 4 years ago

rollrat commented 4 years ago

An error occurs when executing these commands.

flutter run --release
flutter build apk
flutter build apk --split-per-abi
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
     C:\Users\rollrat\.gradle\caches\transforms-2\files-2.1\615cbc3b009c6ace60b4a000b7c5707b\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\Users\rollrat\.gradle\caches\transforms-2\files-2.1\615cbc3b009c6ace60b4a000b7c5707b\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 33s

C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:10: error: cannot find symbol
import androidx.lifecycle.DefaultLifecycleObserver;
                         ^
  symbol:   class DefaultLifecycleObserver
  location: package androidx.lifecycle
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:20: error: cannot find symbol
import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter;
                                                    ^
  symbol:   class FlutterLifecycleAdapter
  location: package io.flutter.embedding.engine.plugins.lifecycle
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:36: error: cannot find symbol
            implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
                                                               ^
  symbol:   class DefaultLifecycleObserver
  location: class FilePickerPlugin
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:43: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:47: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:51: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:55: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:59: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:64: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:258: error: cannot find symbol
            this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
                             ^
  symbol:   variable FlutterLifecycleAdapter
  location: class FilePickerPlugin
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:259: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
            this.lifecycle.addObserver(this.observer);
                                           ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:267: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
        this.lifecycle.removeObserver(this.observer);
                                          ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':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 1s

The plugin file_picker could not be built due to the issue above.

When the keyboard_visibility package was excluded, it was built normally. I referenced issue https://github.com/adee42/flutter_keyboard_visibility/issues/42, but it wasn't fixed. This is the source code where the error occurred. https://github.com/rollrat/violet/tree/4272cac7ce53d75c54238f9c2f325d54b525ca5c Enabling keyboard_visibility in pubspec.yaml gives the same error.

MisterJimson commented 4 years ago

I suggest using my fork: https://github.com/MisterJimson/flutter_keyboard_visibility

trgan96 commented 3 years ago

An error occurs when executing these commands.

flutter run --release
flutter build apk
flutter build apk --split-per-abi
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
     C:\Users\rollrat\.gradle\caches\transforms-2\files-2.1\615cbc3b009c6ace60b4a000b7c5707b\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\Users\rollrat\.gradle\caches\transforms-2\files-2.1\615cbc3b009c6ace60b4a000b7c5707b\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 33s

C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:10: error: cannot find symbol
import androidx.lifecycle.DefaultLifecycleObserver;
                         ^
  symbol:   class DefaultLifecycleObserver
  location: package androidx.lifecycle
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:20: error: cannot find symbol
import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter;
                                                    ^
  symbol:   class FlutterLifecycleAdapter
  location: package io.flutter.embedding.engine.plugins.lifecycle
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:36: error: cannot find symbol
            implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
                                                               ^
  symbol:   class DefaultLifecycleObserver
  location: class FilePickerPlugin
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:43: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:47: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:51: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:55: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:59: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:64: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:258: error: cannot find symbol
            this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
                             ^
  symbol:   variable FlutterLifecycleAdapter
  location: class FilePickerPlugin
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:259: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
            this.lifecycle.addObserver(this.observer);
                                           ^
C:\Dev\flutter\.pub-cache\hosted\pub.dartlang.org\file_picker-1.9.0\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:267: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
        this.lifecycle.removeObserver(this.observer);
                                          ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
12 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':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 1s

The plugin file_picker could not be built due to the issue above.

When the keyboard_visibility package was excluded, it was built normally. I referenced issue #42, but it wasn't fixed. This is the source code where the error occurred. https://github.com/rollrat/violet/tree/4272cac7ce53d75c54238f9c2f325d54b525ca5c Enabling keyboard_visibility in pubspec.yaml gives the same error.

please download this package and add to your project and after you must upgrade build.gradle version ( 3.5.0 or higher). You can use this way

yjlcoder commented 3 years ago

In your android/build.gradle, add following lines:

subprojects {
    afterEvaluate { project ->
        if (project.name == "keyboard_visibility") {
            android {
                compileSdkVersion 28
            }
        }
    }
}

reference: https://stackoverflow.com/a/62677582