Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/217.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Flatter项目无法生成,存在各种错误_Android_Flutter_Gradle - Fatal编程技术网

Android Flatter项目无法生成,存在各种错误

Android Flatter项目无法生成,存在各种错误,android,flutter,gradle,Android,Flutter,Gradle,我从Github获得了源代码,下载了zip文件,并使用Android Studio(最新版本)打开,然后我命令Pub Get下载依赖项。我想当我按下build按钮时,它可能会像另一个Flitter android应用程序一样工作 但它显示了很多错误,我尝试了Stackoverflow中的各种方法和Google中的解决方案,但所有的解决方案都不起作用 我使用的来源是 源代码没问题,因为 我尝试了在线IDE,因为我认为问题出在IDE设置上,但也没有问题。 似乎错误来自于渐变设置或版本。 我怎样才能解

我从Github获得了源代码,下载了zip文件,并使用Android Studio(最新版本)打开,然后我命令Pub Get下载依赖项。我想当我按下build按钮时,它可能会像另一个Flitter android应用程序一样工作

但它显示了很多错误,我尝试了Stackoverflow中的各种方法和Google中的解决方案,但所有的解决方案都不起作用

我使用的来源是

源代码没问题,因为

我尝试了在线IDE,因为我认为问题出在IDE设置上,但也没有问题。 似乎错误来自于渐变设置或版本。 我怎样才能解决这个问题

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps at

https://flutter.dev/go/android-project-migration

to migrate your project.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Launching lib\main.dart on SM N986N in debug mode...
Running Gradle task 'assembleDebug'...
lib/services/connection.g.dart:9:7: Error: The non-abstract class 'ConnectionAdapter' is missing implementations for these members:
 - TypeAdapter.typeId
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.

class ConnectionAdapter extends TypeAdapter<Connection> {
      ^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/hive-1.4.4+1/lib/src/registry/type_adapter.dart:7:11: Context: 'TypeAdapter.typeId' is defined here.
  int get typeId;
          ^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:179:19: Error: The method 'inheritFromWidgetOfExactType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'inheritFromWidgetOfExactType'.
        ? context.inheritFromWidgetOfExactType(type) as _Provider<T>
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:180:19: Error: The method 'ancestorInheritedElementForWidgetOfExactType' isn't defined for the class 'BuildContext'.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorInheritedElementForWidgetOfExactType'.
        : context.ancestorInheritedElementForWidgetOfExactType(type)?.widget
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/shared/custom_bottom_sheet.dart:291:30: Error: No named parameter with the name 'shadowThemeOnly'.
    theme: Theme.of(context, shadowThemeOnly: true),
                             ^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {
                   ^^
lib/shared/custom_show_dialog.dart:269:36: Error: Method not found: 'ButtonTheme.bar'.
      children.add(new ButtonTheme.bar(
                                   ^^^
lib/shared/custom_show_dialog.dart:635:30: Error: No named parameter with the name 'shadowThemeOnly'.
    theme: Theme.of(context, shadowThemeOnly: true),
                             ^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match.
  static ThemeData of(BuildContext context) {
                   ^^
lib/pages/home.dart:88:7: Error: No named parameter with the name 'resizeToAvoidBottomPadding'.
      resizeToAvoidBottomPadding: true,
      ^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/scaffold.dart:1451:9: Context: Found this candidate, but the arguments don't match.
  const Scaffold({
        ^^^^^^^^


FAILURE: Build failed with an exception.

* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 991

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* 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 7s
Exception: Gradle task assembleDebug failed with exit code 1

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
警告
──────────────────────────────────────────────────────────────────────────────
您的颤振应用程序是使用旧版本的Android创建的
嵌入。为了支持安卓嵌入v2,它被弃用了。遵循
步
https://flutter.dev/go/android-project-migration
以迁移项目。
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
正在调试模式下启动SM N986N上的lib\main.dart。。。
正在运行Gradle任务“assembleDebug”。。。
lib/services/connection.g.dart:9:7:错误:非抽象类“ConnectionAdapter”缺少这些成员的实现:
-TypeAdapter.typeId
试着
-实施,,
-从超类或mixin继承实现,
-将类标记为抽象类,或
-提供“noSuchMethod”实现。
类ConnectionAdapter扩展了TypeAdapter{
^^^^^^^^^^^^^^^^^
/C:/flatter/.pub cache/hosted/pub.dartlang.org/hive-1.4.4+1/lib/src/registry/type_adapter.dart:7:11:Context:此处定义了“TypeAdapter.typeId”。
int获取typeId;
^^^^^^
/C:/flatter/.pub cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:179:19:错误:未为类“BuildContext”定义方法“inheritFromWidgetOfExactType”。
-“BuildContext”来自“package:flatter/src/widgets/framework.dart”(“/C:/flatter/packages/flatter/lib/src/widgets/framework.dart”)。
请尝试将名称更正为现有方法的名称,或定义名为“inheritFromWidgetOfExactType”的方法。
?context.inheritFromWidgetOfExactType(类型)作为_提供程序
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flatter/.pub cache/hosted/pub.dartlang.org/provider-2.0.1+1/lib/src/provider.dart:180:19:错误:未为类“BuildContext”定义方法“ancestorInheritedElementForWidgetOfExactType”。
-“BuildContext”来自“package:flatter/src/widgets/framework.dart”(“/C:/flatter/packages/flatter/lib/src/widgets/framework.dart”)。
请尝试将名称更正为现有方法的名称,或定义名为“ancestorInheritedElementForWidgetOfExactType”的方法。
:context.ancestorInheriteElementForWidgeToFexactType(类型)?.widget
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/shared/custom\u bottom\u sheet.dart:291:30:错误:没有名为“shadowThemeOnly”的命名参数。
主题:主题。of(上下文,阴影主题:真),
^^^^^^^^^^^^^^^
/C:/flatter/packages/flatter/lib/src/material/theme.dart:107:20:Context:找到此候选项,但参数不匹配。
的静态主题数据(BuildContext上下文){
^^
lib/shared/custom\u show\u对话框。dart:269:36:错误:找不到方法:“ButtonTheme.bar”。
儿童。添加(新按钮teme.bar(
^^^
lib/shared/custom\u show\u对话框。dart:635:30:错误:没有名为“shadowThemeOnly”的命名参数。
主题:主题。of(上下文,阴影主题:真),
^^^^^^^^^^^^^^^
/C:/flatter/packages/flatter/lib/src/material/theme.dart:107:20:Context:找到此候选项,但参数不匹配。
的静态主题数据(BuildContext上下文){
^^
lib/pages/home.dart:88:7:错误:没有名为“resizetoavidbottompadding”的命名参数。
resizeToAvoidBottomPadding:true,
^^^^^^^^^^^^^^^^^^^^^^^^^^
/C:/flatter/packages/flatter/lib/src/material/scaffold.dart:1451:9:Context:找到此候选项,但参数不匹配。
施工脚手架({
^^^^^^^^
失败:生成失败,出现异常。
*其中:
脚本“C:\flatter\packages\flatter\u tools\gradle\flatter.gradle”行:991
*出了什么问题:
任务“:app:compileFlutterBuildDebug”的执行失败。
>进程“command”C:\flatter\bin\flatter.bat“”以非零退出值1结束
*尝试:
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获取完整的细节。
*得到更多的帮助https://help.gradle.org
构建在7秒内失败
异常:Gradle任务assembleDebug失败,退出代码为1
尝试运行此-

  • 颤振通道稳定
  • 颤振升级
  • 扑通
  • 要删除此警告,请执行以下操作:

    您的flatter应用程序是使用旧版本的安卓嵌入式创建的

    您可以将其添加到活动标记下的AndroidManifest.xml中

    <meta-data
             android:name="flutterEmbedding"
             android:value="2" />
    
    
    
    这将删除警告。

    尝试运行此命令-

  • 颤振通道稳定
  • 颤振升级
  • 扑通
  • 要删除此警告,请执行以下操作:

    您的flatter应用程序是使用旧版本的安卓嵌入式创建的

    你可以加上这个