Android资源链接失败Flutter [英] Android resource linking failed Flutter

查看:65
本文介绍了Android资源链接失败Flutter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了这个奇怪的问题,在这里我遇到了这个错误.

I am running into this weird issue where I am getting this error.

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\live\project_backup\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

BUILD FAILED in 15s

奇怪的是,这是在我升级 file_picker 软件包之后发生的,即使我再次将pubspec.yaml降级,该问题仍然存在.但是,当我尝试从备份运行项目并将lib文件夹替换为发生此错误的文件夹时,它可以完美运行.发生此错误时,插件降级,抖动清除不起作用.为什么会发生此问题?当我点击错误链接时,我被重定向到file_picker-> intermediate-> library_manifest-> debug-> Android Manifest.xml,那里的代码如下所示.

Weird thing is this happens after I upgrade file_picker package and persists even if I downgrade in pubspec.yaml again. But when I try run the project from the backup and replace lib folder with the one where this error occurred, it works perfectly. When this error occurs, plugin downgrade, flutter clean doesn't work. Why is this issue happening? When I click on the error link I am redirected to file_picker->intermediate->library_manifest->debug->Android Manifest.xml and the code there looks as below.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mr.flutter.plugin.filepicker" >

    <uses-sdk android:minSdkVersion="16" />

    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <queries>
        <intent>
            <action android:name="android.intent.action.GET_CONTENT" />

            <data android:mimeType="*/*" />
        </intent>
    </queries>

关于什么是错误以及如何解决此问题的任何建议?

Any suggestions on what is wrong and how to fix this?

推荐答案

我刚刚找到解决方案,查询是一个新的manifest元素,需要使用新的gralde android插件.

I just found out the solution, queries is a new manifest element and require to use a new gralde android plugin.

因此在build.gradle中更改此版本,这对我有用

so change to this version in build.gradle, this worked for me

classpath 'com.android.tools.build:gradle:4.1.0'

还按照4.1.0插件的要求将gradle-wrapper版本更改为6.5

Also change gradle-wrapper version to 6.5 as it is required by 4.1.0 plugin

仅当应用程序无法在发布模式下运行时才使用此方法,否则请使用上述方法.

use this if and only if app does not work in release mode, otherwise use above method.

使用file_picker版本 file_picker:2.0.7 请记住,不带^符号.仅使用android gradle插件3.5,请勿迁移到4.1.0.

use file_picker version file_picker: 2.0.7 remember without ^ symbol. use android gradle plugin 3.5 only and don't migrate to 4.1.0.

这篇关于Android资源链接失败Flutter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆