flutter新创建项目报错 A license was specified in podspec `integration_test` but the file does not exist

估计最近很多新创建flutter项目的小伙伴会发现,运行会报错
具体分两种情况:
iOS报错

Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.

[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] A license was specified in podspec `integration_test` but the file does not exist - /Users/pedromassango/Desktop/xyz/ios/.symlinks/plugins/integration_test/LICENSE

[!] Unable to read the license file `../LICENSE` for the spec `integration_test (0.0.1)`

[!] Unable to read the license file `../LICENSE` for the spec `integration_test (0.0.1)`

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `Runner` to `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` or include the `Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig` in your build configuration (`Flutter/Release.xcconfig`).
pedromassango@MacBook-Pro-de-MacBook ios % 

怎么处理呢?

Automatically assigning platform `iOS` with version `9.0` on target `Runner`

第一个问题很好解决,进入ios文件夹打开podfile文件,将 platform :ios, '9.0'取消注释即可。

后面三个问题如何解决呢?
多是因为ruby版本过低导致的,升级本机的ruby即可 ,建议升级到2.7.1

Hello, I have the same problem.
The problem is caused because the function `Dir.new (configuration_engine_dir).each_child` that is inside the file podhelper.rb was introduced only in ruby ​​2.5, while the version of it on my machine for example is still in 2.0

There should be some validation on the side of the flutter to avoid problems in this regard

This bug was introduced in this [pull](https://github.com/flutter/flutter/pull/71495)

升级ruby可以参考这篇文章 升级ruby

升级完成以后,估计本地的cocoapods也不可用,此时也需要重新安装一下(不一定哦,我的就需要重新安装),重新安装cocoapods可以参考这篇文章 安装cocoapods。

安装完成以后就啦,运行flutter run没有任何问题了。具体可以参考
flutter官网issue

Android报错:

Exception in thread "main" java.net.ConnectException: Operation timed out (Connection timed out)
        at java.net.PlainSocketImpl.socketConnect(Native Method)        
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)   
        at java.net.Socket.connect(Socket.java:607)                     
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
        at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:180)      
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)  
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)  
        at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1570)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
        at org.gradle.wrapper.Download.download(Download.java:44)       
        at org.gradle.wrapper.Install$1.call(Install.java:61)           
        at org.gradle.wrapper.Install$1.call(Install.java:48)           
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
        at org.gradle.wrapper.Install.createDist(Install.java:48)       
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        77.0s
Exception: Gradle task assembleDebug failed with exit code 1

是由于下载gradle配置文件,而地址却是国外的地址,导致下载失败,处理方式如下
打开新建的工程项目文件gradle-wrapper.properties(路径android/gradle/wrapper/gradle-wrapper.properties)
将该文件里面distributionUrl的地址改为本地已经下载下来的路径
distributionUrl=file:///Users/wuai/Downloads/Flutter/gradle/gradle-6.8.1-all.zip

其中gradle包是从这个地址下载下来的,如果后面需要更新gradle,可以从这个地址下载 gradle6.8.1下载

你可能感兴趣的:(flutter新创建项目报错 A license was specified in podspec `integration_test` but the file does not exist)