3月一次偶然也是必然的機會,促使自己有想法學習flutter,下面就遇到的一些問題進行記錄。
一、安裝flutter遇到的問題:
1、Mac終端輸入命令總是出現command not found!
解決:https://blog.csdn.net/fuyundage/article/details/79516286
2、Mac安裝Python3報錯:
Permission denied @ dir_s_mkdir - /usr/local/Frameworks
Warning: python 3.7.2_1 is already installed, it's just not linked.
You can use brew link python
to link this version.
解決:http://www.lxweimin.com/p/965fd0be3f0c
二、運行flutter項目報錯:
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: 25What 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.
參考解決方案:
- 修改源
- 翻墻--下載了PeerVPN
- 修改項目的/android/app/build.gradle文件中的sdk版本號為28 (運行成功后,我改回27正常運行,估計更多的是墻原因吧,版本號不礙事)
三、Android Studio找不到iPhone真機
iPhone模擬器:
終端輸入:flutter doctor命令
可以發現,設備選擇中能找到iPhone模擬器
真機:發現沒有可選的真機可用
參考解決:http://www.lxweimin.com/p/69e1efc2fc55