解决Flutter 打包提示attr/fontVariationSettings not found、attr/ttcIndex not found的问题

解决Flutter 打包提示Android resource linking failed 、attr/fontVariationSettings not found、attr/ttcIndex not found的问题

代码写完了,用安卓真机可以直接调试,但是执行flutter build apk -t lib/main_prod.dart 的时候,提示如下信息

FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':adhara_socket_io:verifyReleaseResources'.   
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed                                    
     /Users/**/.gradle/caches/transforms-2/files-2.1/8b6ccf1247153bdb61a5468cf8f65720/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
                                                                        
     /Users/**/.gradle/caches/transforms-2/files-2.1/8b6ccf1247153bdb61a5468cf8f65720/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 
……………这里是分割线……………

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':generateReleaseRFile'.
> This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
  The following AndroidX dependencies are detected: androidx.annotation:annotation:1.1.0

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':javaPreCompileRelease'.
> This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
  The following AndroidX dependencies are detected: androidx.annotation:annotation:1.1.0

* 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

原因分析:

看到Execution failed for task ‘:adhara_socket_io:verifyReleaseResources’. 。
根据提示信息,应该是adhara_socket_io这个插件的问题,找到这个这个查看,根据网上搜索的方法,应该是compileSdkVersion 的版本低于28


解决方案:

打开adhara_socket_io的build.gradle,找到 compileSdkVersion ,看到是27,直接改为28就好了:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值