image_picker 构建时抛出异常

2023-11-23

我现在正在与 image_picker 解决问题两天。它是从昨天中午我尝试调试我的应用程序时开始的。之前它会调试得很好,据我记得当时我没有改变任何东西。它抛出了unexpected element <queries> found in <manifest>.错误,就像下面今天的错误日志一样,它启动了 Jetfier 来解决不兼容问题。 Jetfier 昨天抛出的错误类似于SDK location not found. Define location in local.properties or with an ANDROID_SDK_ROOT environment variable。但是 SDK 位置是在 local.properties 中定义的,我还创建了ANDROID_SDK_ROOT环境。变量与 SDK 位置但错误保持不变。

今天我彻底清除了flutter文件夹并重新安装了它。之后我遇到了一些设备信息问题,但最终得到了解决。现在我被困在这里,没有任何进展。如果我删除<queries> in AndroidManifest.xml,当尝试运行程序时它会再次放在那里,所以这不是解决方案。

我把它叫进去pubspec.yaml as file_picker: ^2.0.10在依赖项下,我尝试过pub get, pub cache repair, pub clean以不同的顺序。如果我删除file_picker以及它在项目中的所有用途,应用程序的其余部分运行得很好。我试过file_picker在另一个项目中,有一些更基本的东西,它也在那里抛出了相同的异常。

下面是错误代码。如果您需要更多详细信息,请告诉我。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     C:\Users\ASUS\AndroidStudioProjects\flutterdb\intern1\build\file_picker\intermediates\library_manifest\debug\AndroidManifest.xml:9:5-15:15: AAPT: error: unexpected element <queries> found in <manifest>.


* 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

BU�LD FAILED in 21s
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 file_picker...
Running Gradle task 'assembleAarRelease'...

C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\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:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\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:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:38: error: cannot find symbol
            implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
                                                               ^
  symbol:   class DefaultLifecycleObserver
  location: class FilePickerPlugin
C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:45: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:49: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:53: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:57: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:61: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:66: error: method does not override or implement a method from a supertype
        @Override
        ^
C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:277: error: cannot find symbol
            this.lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
                             ^
  symbol:   variable FlutterLifecycleAdapter
  location: class FilePickerPlugin
C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:278: error: incompatible types: FilePickerPlugin.LifeCycleObserver cannot be converted to LifecycleObserver
            this.lifecycle.addObserver(this.observer);
                                           ^
C:\Users\ASUS\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\file_picker-2.0.10\android\src\main\java\com\mr\flutter\plugin\filepicker\FilePickerPlugin.java:286: 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

BUİLD FAILED in 3s

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

给那些不知道的人(包括我自己) 那里有两个build.gradle files

  1. android/build.gradle
  2. android/app/build.gradle

步骤 1 里面android/build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        // classpath 'com.android.tools.build:gradle:3.5.0' before
        classpath 'com.android.tools.build:gradle:4.0.1' // after
    }
}

步骤2里面android/gradle/wrapper/gradle-wrapper.properties


distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

# BEFORE
# distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
# AFTER
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip

步骤 3 重建项目

可能需要一段时间,因为它将下载新的 gradle

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

image_picker 构建时抛出异常 的相关文章

随机推荐

  • 去除大量数字(big.Int)

    我正在尝试将两个大数相除 例如 尝试将 50 除以 18 并且我设置了两个 big Int 变量 first MulRange 1 50 second MulRange 1 18 如何划分数字 最好是整数除法 Thanks 我怎样才能划分数
  • 如何在 Objective-C 中的两个类之间进行引用?

    我正在开发一个 iPhone 应用程序 我对 Objective C 以及 class h 和 class m 结构有点陌生 现在 我有两个类 它们都需要具有另一个类型的变量 但这似乎是不可能的 如果在class1 m 或class2 m
  • 列出 javascript 中所有内置函数?

    js 有没有办法列出所有内置函数及其参数列表上的一些信息 我真的找不到任何关于反射来做这类事情的东西 编辑 Math sin之类的函数其实就是我要列出的 实际上都是内置函数 也许是这样的 for var x in window if win
  • 确定文件是否正在 Windows 上的 Perl 中使用

    我正在编写一些 Perl 它获取 Windows Media Center 上录制的电视节目 并根据某些条件移动 重命名 删除它们 由于 Perl 运行相当频繁 我想清楚地确定该文件是否正在使用 换句话说 节目正在录制过程中 这样我就可以避
  • Python 3:UnboundLocalError:赋值之前引用的局部变量[重复]

    这个问题在这里已经有答案了 下面的代码给出了错误UnboundLocalError local variable Var1 referenced before assignment Var1 1 Var2 0 def function if
  • 如何使用 Perl 从文本文件中提取 IP 地址?

    如何从每行都有 IP 地址的文本文件中提取 IP 地址 我想提取 IP 然后在单独的文件中列出 IP 地址 包含 IP 的文本文件采用以下格式 主机 somehost com 192 168 1 1 已启动 0 20 秒延迟 主机 10 1
  • Java 8 默认方法作为特征:安全吗?

    使用安全做法吗默认方法是穷人版本的特质在 Java 8 中 有人声称这可能会让熊猫感到悲伤如果你只是为了使用它们 因为它很酷 但这不是我的意图 人们还经常提醒 引入默认方法是为了支持 API 演化和向后兼容性 这是事实 但这并不意味着将它们
  • 如何访问深度嵌套的 json 键和值

    我正在用 Go 编写一个 websocket 客户端 我从服务器收到以下 JSON args time 2013 05 21 16 57 17 name send time 我正在尝试访问time参数 但就是无法掌握如何深入到接口类型 pa
  • 如何在ubuntu上彻底清除并重新安装postgresql? [关闭]

    Closed 这个问题不符合堆栈溢出指南 目前不接受答案 这个问题似乎不是关于主要由程序员使用的特定编程问题 软件算法或软件工具 如果您认为该问题与主题相关另一个 Stack Exchange 站点 您可以发表评论来解释问题可以在哪里得到解
  • Z 顺序曲线坐标

    我如何访问使用 Z 顺序以 O 1 时间复杂度存储在数组中的数据 我需要通过坐标快速访问每个元素 有没有比使用 while 移位位更快的方法来访问这些数据 一种方法是使用查找表 我有静态数据大小 EDIT 我现在的一个想法是使用 y SIZ
  • 如何从过滤器中自动选择范围而无需手动输入?

    我想知道是否有一种方法可以根据所选过滤器自动选择单元格范围 Example 在 H 列 中设置过滤器 自动选择从 A 列 A2000 开始的结果单元格数据 C 列 C5000 等 这就是我陷入困境的地方 我不知道如何编写以根据所选过滤器自动
  • MySQL 查询被杀死后不会消失

    我有一个 MySQL 查询 它将数据从一个表复制到另一个表进行处理 由于某种原因 这个通常需要几秒钟的查询被锁定了一夜并运行了几个小时 今天早上登录时 我试图终止该查询 但它仍然列在进程列表中 Id User Host db Command
  • 为什么 Assembly.GetTypes() 需要引用?

    我想从程序集中获取所有类型 但我没有引用 也不关心它们 查找接口类型与引用有什么关系 我有办法解决这个问题吗 Assembly assembly Assembly LoadFrom myAssemblyPath Type typeArray
  • MPAndroidChart:如何自定义条形值标签

    我在我的 Android 应用程序中使用 MPAndroidChart 我用一个BarChart由 组成的BarEntry 我还启用了 y 值显示在栏顶部的功能 我的问题是我希望条形顶部的值是整数 例如5 但目前这些值显示为5 00 那么我
  • iOS 键盘语言更改时是否有委托调用?

    我有一个场景 我希望有一个处理程序 当用户按下 iOS 键盘上的语言更改 地球图标 时 该处理程序会被触发 我怎样才能实现这一目标 Thanks 以下应该有效 您必须在代码中使用 UIKeyboard 通知 NSNotificationCe
  • 如何使用 thymeleaf 在 javascript 中使用 for 循环?

    我正在使用 thymeleaf 所以当我运行这个应用程序时 它给了我一个错误 for int i 0 i h1 R h1
  • 使用打包在 .jar 中的 Thymeleaf 使用 Spring Boot 解析模板时出错

    我有一个使用 Thymeleaf 作为模板解析器的 Spring Boot 应用程序 在从 NetBeans 进行调试时工作正常 但在运行其 jar 时出现此错误 解析模板 theme property 时出错 模板可能不存在或无法被任何配
  • 当选定的 ng-option 更改时获取值

    我的 html 页面中有一个下拉列表 落下
  • 绘制色带在零附近发散的栅格

    我正在尝试绘制具有正值和负值的地图 All positive values should have red color while negative should have blue color and zero should have w
  • image_picker 构建时抛出异常

    我现在正在与 image picker 解决问题两天 它是从昨天中午我尝试调试我的应用程序时开始的 之前它会调试得很好 据我记得当时我没有改变任何东西 它抛出了unexpected element