当前位置:网站首页>搭建flutter环境入坑集合
搭建flutter环境入坑集合
2022-07-06 09:29:00 【社会你磊哥,命硬不弯腰】
搭建flutter环境用了4个下午,真可谓是人生到达了高潮。听人说mac比较好配环境,不过我用的是windows,唉,该遇到的坑基本上统统走了一遍。搭建环境那个我就不讲了,大家可以看一下技术胖的视频在b站上,就说一下遇到的坑,来正文吧。
问题一:遇到了get packages
第三方包问题。没有这玩意代码在编译器环境中会直接报错,获取的方式有两种,第一种是翻墙,这种方式对梯子的要求还是有点高的,不建议使用。第二种是flutter
专门照顾国内用户的,设置镜像源可解决问题。
FLUTTER_STORAGE_BASE_URL = https://storage.flutter-io.cn
PUB_HOSTED_URL = https://pub.flutter-io.cn
强烈建议在这里关闭电脑,重新开启在遇到flutter create project
项目失败或者编译器get packages
第三方包报错的时候。
问题二 Plugin with id 'kotlin-android' not found
这个错误我解决了很久没有解决,在别人帮我解决好问题后得到了解答。这是因为没有正确的引入kotlin-android插件而产生的错误
第一步:在项目android\app目录下build.gradle文件中插入,看清楚是在app目录下的这个文件
apply plugin: 'kotlin-android'
这段代码
效果图如上所示
第二步 项目的androd目录下也有一个build.gradle文件,打开并分别添加下面两段代码在固定的位置
ext.kotlin_version = '1.3.50'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
注意第一段代码是在那个对象的外面,我在调试的过程中放错了位置,导致走了更多的坑。这个问题不出意外已经解决了。
问题三:还有人可能会报这个错误,这个问题我好像没遇到,我调试之前照着技术胖的博客改了一下,这个也是因为墙的原因吧。
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "/Users/rabbit/develop/android/flutter_app/android/gradlew" exited abnormally:
Project evaluation failed including an error in afterEvaluate {
}. Run with --stacktrace for details of the afterEvaluate {
} error.
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/rabbit/develop/android/flutter_app/android/app/build.gradle' line: 25
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all files for configuration 'classpath'.
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar
* 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
Command: /Users/rabbit/develop/android/flutter_app/android/gradlew app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
针对这个错误大家可以参考一下技术胖的博客https://jspang.com/detailed?id=41#toc222,注意需要改两个文件。
问题四:最后就是需要大家注意gradle版本和它插件之间应该是对应的关系,下面有一个表
我这里插件的版本是3.5.0,gradle版本是5.6.2.符合规定。第二个文件的目录是项目\android\gradle\wrapper,查看那个文件就行,不符合上面那个表就更改。
边栏推荐
- LeetCode 1640. Can I connect to form an array
- [unsolved] 7-15 shout mountain
- Chapter III principles of MapReduce framework
- Chapter 1 overview of MapReduce
- Fdog series (V): use QT to imitate QQ to realize login interface to main interface, function chapter.
- LeetCode 1636. Sort the array in ascending order by frequency
- Shell_ 00_ First meeting shell
- Story of [Kun Jintong]: talk about Chinese character coding and common character sets
- Shell_ 05_ operator
- SQL快速入门
猜你喜欢
~68 Icon Font introduction
Record the error reason: terminate called after throwing an instance
音视频开发面试题
The concept of spark independent cluster worker and executor
Chapter 5 yarn resource scheduler
Which is more important for programming, practice or theory [there are some things recently, I don't have time to write an article, so I'll post an article on hydrology, and I'll fill in later]
Use JQ to realize the reverse selection of all and no selection at all - Feng Hao's blog
LeetCode 1560. The sector with the most passes on the circular track
Chapter 7__ consumer_ offsets topic
Solr word segmentation analysis
随机推荐
Shell_ 06_ Judgment and circulation
I'm "fixing movies" in ByteDance
MP4格式详解
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)
LeetCode 1560. The sector with the most passes on the circular track
第一章 MapReduce概述
LeetCode 1020. Number of enclaves
第5章 消费者组详解
Fdog series (V): use QT to imitate QQ to realize login interface to main interface, function chapter.
was unable to send heartbeat
~73 other text styles
~72 horizontal and vertical alignment of text
@RequestMapping、@GetMapping
~71 abbreviation attribute of font
Error: case label `15 'not within a switch statement
LeetCode1556. Thousand separated number
~70 row high
~87 animation
字节跳动技术新人培训全记录:校招萌新成长指南
ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021