【问题标题】:flutter app apk is giving clipboard_manager error颤振应用程序 apk 给出 clipboard_manager 错误
【发布时间】:2021-08-26 00:56:39
【问题描述】:

我正在尝试构建我的颤振应用程序的 apk,但是当我运行此命令时

flutter build apk

我遇到以下错误;

FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':clipboard_manager:verifyReleaseResources'.  
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed                                    
     /home/username/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
                                                                        
     /home/username/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.
                                                                        
                                                                        
* 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 9s    
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                      10.1s
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the
incompatibility.
Building plugin clipboard_manager...
Running Gradle task 'assembleAarRelease'...                             
Running Gradle task 'assembleAarRelease'... Done                   741ms


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'clipboard_manager'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* 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 0s


The plugin clipboard_manager could not be built due to the issue above.  

我收到了flutter pub outdated --mode=null-safety

Package Name            Current   Upgradable  Resolvable  Latest    

direct dependencies:   
clipboard_manager       ✗0.0.4    ✗0.0.4      ✗0.0.4      ✗0.0.4    
cupertino_icons         ✗0.1.3    ✗0.1.3      ✓1.0.3      ✓1.0.3    
dio                     ✗3.0.10   ✗3.0.10     ✓4.0.0      ✓4.0.0    
flutter_circular_chart  ✗0.1.0    ✗0.1.0      ✗0.1.0      ✗0.1.0    
flutter_secure_storage  ✗3.3.5    ✗3.3.5      ✓4.2.0      ✓4.2.0    
flutter_svg             ✗0.19.3   ✗0.19.3     ✓0.22.0     ✓0.22.0   
http                    ✗0.12.2   ✗0.12.2     ✓0.13.3     ✓0.13.3   
image_picker            ✗0.6.5+3  ✗0.6.5+3    ✓0.8.0+3    ✓0.8.0+3  
logger                  ✗0.9.4    ✗0.9.4      ✓1.0.0      ✓1.0.0    
provider                ✗4.3.3    ✗4.3.3      ✓5.0.0      ✓5.0.0    

8  dependencies are constrained to versions that are older than a resolvable version.
To update these dependencies, edit pubspec.yaml, or run `flutter pub upgrade --null-safety`.                     

我已经搜索过了,他们告诉我将 flutter.sdk 更改为 home.username/Android/Sdk 我这样做了,但是在运行 buiuld 命令后,我得到了 home/lechat/snap/flutter/common/flutter在 local.properties 中的 flutter.sdk 中。 我不知道问题到底是什么。请帮我解决这个问题。如果您有任何其他信息,我准备分享。 我也关注了这个问题,related problem 但仍然出现同样的错误。

【问题讨论】:

  • 如果显示 pub 已过时,您是否尝试过更新依赖项并运行 dart fix --dry-run 和 flutter fix --apply?
  • 您能否告诉我执行这些修复的确切命令。真的很有帮助
  • 当然,如果它可以作为答案发布,则可以升级软件包,您可以使用“flutter pub update”。要检查您的应用是否需要 fixe4s,您可以运行“dart --dry-run”,如果需要修复,请运行“flutter fix --apply”
  • 是更新还是升级?
  • 嘿嘿检查这个命令是否正确flutter fix --apply

标签: flutter flutter-dependencies


【解决方案1】:

检查this similar question 有多个答案,他们似乎都完成了工作,但只有一个使用了clipboard_manager。

【讨论】:

  • 您的回答帮助我弄清楚了实际问题是什么,我没有在我的代码中使用剪贴板管理器,只是在一个文件中导入,所以我从我的 pubspec.yaml 中删除了它并解决了错误。
猜你喜欢
  • 2021-03-20
  • 1970-01-01
  • 2018-11-19
  • 1970-01-01
  • 2021-05-01
  • 1970-01-01
  • 2021-08-23
  • 2020-04-20
  • 2020-03-15
相关资源
最近更新 更多