我现在正在与 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
android/build.gradle
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(使用前将#替换为@)