执行 flutter build apk打包app的时候出现一大堆错,明明是按照文档来的啊,怎么就报错了,报错如下:
Warning: io.flutter.embedding.android.FlutterActivity: can't find superclass or interface android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngine: can't find superclass or interface android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find superclass or interface android.arch.lifecycle.LifecycleRegistry
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find superclass or interface android.arch.lifecycle.DefaultLifecycleObserver
Warning: io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding: can't find superclass or interface android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.LifecycleRegistry
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.LifecycleRegistry
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.LifecycleRegistry
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.LifecycleRegistry
Warning: io.flutter.embedding.android.FlutterActivity: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.android.FlutterActivityAndFragmentDelegate$Host: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.android.FlutterFragment: can't find referenced method 'void setArguments(android.os.Bundle)' in program class io.flutter.embedding.android.FlutterFragment
Warning: io.flutter.embedding.android.FlutterFragment: can't find referenced method 'android.support.v4.app.FragmentActivity getActivity()' in program class io.flutter.embedding.android.FlutterFragment
Warning: io.flutter.embedding.android.FlutterFragment: can't find referenced method 'android.os.Bundle getArguments()' in program class io.flutter.embedding.android.FlutterFragment
Warning: io.flutter.embedding.android.FlutterFragment$1: can't find referenced method 'android.support.v4.app.FragmentActivity getActivity()' in program class io.flutter.embedding.android.FlutterFragment
Warning: io.flutter.embedding.android.FlutterFragment$CachedEngineFragmentBuilder: can't find referenced method 'void setArguments(android.os.Bundle)' in program class io.flutter.embedding.android.FlutterFragment
Warning: io.flutter.embedding.android.FlutterFragment$NewEngineFragmentBuilder: can't find referenced method 'void setArguments(android.os.Bundle)' in program class io.flutter.embedding.android.FlutterFragment
Warning: io.flutter.embedding.android.FlutterView: can't find referenced method 'android.graphics.Insets getSystemGestureInsets()' in library class android.view.WindowInsets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.android.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.embedding.engine.FlutterEngine: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngine: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.LifecycleRegistry
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.LifecycleRegistry
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle$State
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced method 'void markState(android.arch.lifecycle.Lifecycle$State)' in program class io.flutter.embedding.engine.FlutterEngineAndroidLifecycle
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.LifecycleRegistry
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle$State
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.LifecycleObserver
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.DefaultLifecycleObserver
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.Lifecycle$Event
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEngineAndroidLifecycle$1: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.FlutterEnginePluginRegistry: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEnginePluginRegistry: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEnginePluginRegistry: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEnginePluginRegistry: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEnginePluginRegistry: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEnginePluginRegistry: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEnginePluginRegistry: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEnginePluginRegistry: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.FlutterEnginePluginRegistry: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding: can't find referenced class android.arch.lifecycle.LifecycleOwner
Warning: io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.plugins.FlutterPlugin$FlutterPluginBinding: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.plugins.activity.ActivityControlSurface: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.plugins.broadcastreceiver.BroadcastReceiverControlSurface: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.plugins.contentprovider.ContentProviderControlSurface: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.embedding.engine.plugins.service.ServiceControlSurface: can't find referenced class android.arch.lifecycle.Lifecycle
Warning: io.flutter.view.FlutterView: can't find referenced method 'android.graphics.Insets getSystemGestureInsets()' in library class android.view.WindowInsets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Warning: io.flutter.view.FlutterView: can't find referenced class android.graphics.Insets
Note: io.flutter.view.AccessibilityViewEmbedder$ReflectionAccessors: can't find dynamically referenced class android.util.LongArray
Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class kotlin.internal.jdk8.JDK8PlatformImplementations
Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class kotlin.internal.JRE8PlatformImplementations
Note: kotlin.internal.PlatformImplementationsKt: can't find dynamically referenced class kotlin.internal.JRE7PlatformImplementations
Note: kotlin.jvm.internal.Reflection: can't find dynamically referenced class kotlin.reflect.jvm.internal.ReflectionFactoryImpl
Note: there were 5 unresolved dynamic references to classes or interfaces.
You should check if you need to specify additional program jars.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
Thread(Tasks limiter_2): destruction
Warning: there were 89 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 7 unresolved references to program class members.
Your input classes appear to be inconsistent.
You may need to recompile the code.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning: there were 2 unresolved references to library class members.
You probably need to update the library versions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs 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 2s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 3.4s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleRelease failed with exit code 1
然后google了一番,说是Proguard 导致的。取消了就好, 然后就进入 android/app/build.gradle中:
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
// minifyEnabled true
// useProguard true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
注释掉添加的混淆代码的功能就好了。
使用的过程中遇到了问题,记录一下。