当前位置:网站首页>搭建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,查看那个文件就行,不符合上面那个表就更改。
边栏推荐
- ~74 JD top navigation bar exercise
- ~69 other ways to use icon fonts
- LeetCode 1552. Magnetic force between two balls
- Cmake Express
- Shell_ 01_ data processing
- LeetCode 1566. Repeat the pattern with length m at least k times
- LeetCode 1638. Count the number of substrings with only one character difference
- The most lost road I have ever walked through is the brain circuit of ByteDance programmers
- Shell_ 05_ operator
- Ffmpeg command line use
猜你喜欢

Shell_ 05_ operator

Shell_ 01_ data processing

Fdog series (III): use Tencent cloud SMS interface to send SMS, write database, deploy to server, web finale.
![Saw local status change event StatusChangeEvent [timestamp=1644048792587, current=DOWN, previous=UP]](/img/e6/c53ad67ead1793a2acb93c26e8d377.jpg)
Saw local status change event StatusChangeEvent [timestamp=1644048792587, current=DOWN, previous=UP]

第6章 DataNode

CMake速成

~Introduction to form 80

Data config problem: the reference to entity 'useunicode' must end with ';' delimiter.

Mp4 format details

图像处理一百题(1-10)
随机推荐
[unsolved]7-14 calculation diagram
ffmpeg命令行使用
~74 JD top navigation bar exercise
谢邀,人在工区,刚交代码,在下字节跳动实习生
LeetCode 1584. Minimum cost of connecting all points
LeetCode 1641. Count the number of Lexicographic vowel strings
LeetCode 1562. Find the latest group of size M
The most lost road I have ever walked through is the brain circuit of ByteDance programmers
~68 Icon Font introduction
Shell_ 07_ Functions and regular expressions
我走過最迷的路,是字節跳動程序員的腦回路
LeetCode 1636. Sort the array in ascending order by frequency
字节跳动技术面试官现身说法:我最想pick什么样的候选人
Introduction to microservices
Fdog series (V): use QT to imitate QQ to realize login interface to main interface, function chapter.
LeetCode 1552. Magnetic force between two balls
LeetCode 1637. The widest vertical area between two points without any point
7-6 sum of combinatorial numbers
Basic principles of video compression coding and audio compression coding
Shell_ 06_ Judgment and circulation