flutter编译问题:Execution failed for task ':shared_preferences:verifyReleaseResources'.

记录些自己开发中碰到的问题,方便自己方便他人。

下面是日志输出:

FAILURE: Build failed with an exception.                                
                                                                        
* What went wrong:                                                      
Execution failed for task ':shared_preferences:verifyReleaseResources'. 
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed                                    
     /Users/frc/.gradle/caches/transforms-2/files-2.1/57be7675b54dfb29ebcc82c3cf8bfd14/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
                                                                        
     /Users/frc/.gradle/caches/transforms-2/files-2.1/57be7675b54dfb29ebcc82c3cf8bfd14/core-1.0.0/res/values/values.xml:57:5-88: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 32s                                                     


Execution failed for task ':xxx(三方库名):verifyReleaseResources.其实是个挺常见的问题,可能是flutter目前开发者有限,所以在flutter上不多。网上一搜都是rect-navtive的。其实主要是版本内部东西于当前版本不兼容,或者说你当前依赖的三方库肯能有东西已经过期了。

image.png

看了下当前的shared_preferences是0.4.2,再到库下载地址去查下最新的。
image.png

看到我这个库有点太久了,更新下试试。


image.png

看到编译成功了。体积比之前还小了好多。


其实我们可以看下他到底有哪些改动


image.png

因为之前看到过下面的日志:


* What went wrong:
A problem occurred configuring root project 'flutter_plugin_android_lifecycle'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.5.3.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.5.3.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
               > Connect to 127.0.0.1:8888 [/127.0.0.1] failed: Connection refused (Connection refused)
      > Could not resolve com.android.tools.build:gradle:3.5.3.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
               > Connect to 127.0.0.1:8888 [/127.0.0.1] failed: Connection refused (Connection refused)


所以我猜测可能跟下面的升级有关:


image.png

你可能感兴趣的:(flutter编译问题:Execution failed for task ':shared_preferences:verifyReleaseResources'.)