当前位置:网站首页>搭建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,查看那个文件就行,不符合上面那个表就更改。
边栏推荐
- Ffmpeg command line use
- SQL quick start
- Hbuilder x format shortcut key settings
- How to generate six digit verification code
- 「博士毕业一年,我拿下 ACL Best Paper」
- DS18B20数字温度计系统设计
- 第6章 Rebalance详解
- CMake Error: Could not create named generator Visual Studio 16 2019解决方法
- LeetCode 1020. Number of enclaves
- Fdog series (V): use QT to imitate QQ to realize login interface to main interface, function chapter.
猜你喜欢
Fdog series (I): think about it. It's better to write a chat software. Then start with the imitation QQ registration page.
视频压缩编码和音频压缩编码基本原理
Detailed explanation of FLV format
J'ai traversé le chemin le plus fou, le circuit cérébral d'un programmeur de saut d'octets
Two weeks' experience of intermediate software designer in the crash soft exam
「博士毕业一年,我拿下 ACL Best Paper」
100张图训练1小时,照片风格随意变,文末有Demo试玩|SIGGRAPH 2021
这116名学生,用3天时间复刻了字节跳动内部真实技术项目
姚班智班齐上阵,竞赛高手聚一堂,这是什么神仙编程大赛?
~69 other ways to use icon fonts
随机推荐
Spark independent cluster dynamic online and offline worker node
图像处理一百题(11-20)
Full record of ByteDance technology newcomer training: a guide to the new growth of school recruitment
字节跳动技术新人培训全记录:校招萌新成长指南
Chapter 5 yarn resource scheduler
TypeScript基本操作
Saw local status change event StatusChangeEvent [timestamp=1644048792587, current=DOWN, previous=UP]
Codeforces Round #771 (Div. 2)
was unable to send heartbeat
Gridhome, a static site generator that novices must know
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)
How to configure hosts when setting up Eureka
Usage of insert() in vector
ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
Simply try the new amp model of deepfacelab (deepfake)
7-5 blessing arrived
Error occurred during initialization of VM Could not reserve enough space for object heap
Record the error reason: terminate called after throwing an instance
The most lost road I have ever walked through is the brain circuit of ByteDance programmers
Chapter 5 detailed explanation of consumer groups