1. Using Flutter in China
- 官网
- 新增环境变量
- PUB_HOSTED_URL=https://pub.flutter-io.cn
- FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
2. vscode Waiting for another flutter command to release the startup lock...
- 任务管理器, 关闭对应的 dart 进程
3. Could not resolve all files for configuration ':app:debugCompileClasspath'.
- flutter doctor
- flutter clean
4. Running Gradle task 'assembleDebug'... forever
-
修改 工程下 android/build.gradle
- //google()
- //jcenter()
- maven { url 'maven.aliyun.com/repository/…' }
- maven { url 'maven.aliyun.com/repository/…' }
- maven { url 'maven.aliyun.com/nexus/conte…' }
-
Flutter安装目录/packages/flutter_tools/gradle/flutter.gradle
- //google()
- //jcenter()
- maven { url 'maven.aliyun.com/repository/…' }
- maven { url 'maven.aliyun.com/repository/…' }
- maven { url 'maven.aliyun.com/nexus/conte…' }
-
工程下 android/app/build.gradle
- compileSdkVersion
- targetsdkversion
- 分别修改为对应模拟器的api版本号
5. 编译环境找不到aidl
- C:\Users\userName\AppData\Local\Android\Sdk\build-tools\26.0.2
- 删除指定目录下的 版本文件夹, 重新运行debug, 重新下载即可
6. FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. > More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro'
- blog.csdn.net/SweetTool/a…
- stackoverflow.com/questions/5…
- 工程下 android/app/build.gradle
- android 下新增packagingOptions {exclude 'META-INF/proguard/androidx-annotations.pro'}
7. unimplemented handling of missing static target flutter
- flutter clean
8. sqlite OS error - 2:No such file or directory
9. flutter 填坑指南
10. Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.2] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:15:5-38:19 to override.
- flutter clean
11. I/flutter ( 8952): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY I/flutter ( 8952): The following NoSuchMethodError was thrown building StreamBuilder(dirty, dependencies: I/flutter ( 8952): [_LocalizationsScope-[GlobalKey#b90a8], _InheritedTheme], state: _StreamBuilderBaseState<int,I/flutter ( 8952): AsyncSnapshot>#fb3ec):I/flutter ( 8952): The method '>' was called on null.I/flutter ( 8952): Receiver: null I/flutter ( 8952): Tried calling: >(0)
- snapshot.hasData && snapshot.data != null
- 数据判空
12. flutter debug 输出旧日志
- AVD manager 选中指定 emulator => wipe data
13. flutter http SocketException: OS Error: Connection refused, errno = 111, address = localhost, port = 57032
- 修改 调用地址 "localhost" 为 本机ip
http://###.###.#.###:####