10

【Flutter】参与别人flutter项目踩坑填坑记录

 3 years ago
source link: https://blog.vadxq.com/article/flutter-run-other-project/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

【Flutter】参与别人flutter项目踩坑填坑记录

参与别人flutter项目踩坑填坑记录,零散报错以及经历的解决方法。初次接触企业级项目,有些配置之类的和自己玩的不太一样,还有些依赖,以及一些配置项的规范化,版本的规定等可能导致自己在运行中出现环境冲突的问题。

对应Android零散报错以及经历的解决方法

出现如下报错信息

.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。

临时解决方案:在工程build.gradle里面找到allprojects加入如下代码:

gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << “-Xlint:unchecked” << “- Xlint:deprecation”
}
}

解决方法:

  • 原因:TODO正在查找
  • 解决方法:TODO正在查找
  • 发现时间:2020.11.12
  • 更新时间:2020.11.12

Could not determine the dependencies of task

Could not determine the dependencies of task ':app:preDebugBuild
  • 解决方法:运行flutter clean
  • 效果:本次运行有效,可能有特殊适用性,待以后更多结果反馈
  • 发现时间:2020.11.12
  • 更新时间:2020.11.12

A problem occurred configuring root project ‘connectivity’

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'connectivity'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

尝试解决方法:

运行flutter cleanflutter pub cache repair:效果,出现下一个问题情况

解决方案:

  • 解决方法:运行flutter clean
  • 效果:本次运行有效,可能有特殊适用性,待以后更多结果反馈
  • 发现时间:2020.11.12
  • 更新时间:2020.11.12

pub get failed (66

pub get failed (66; Could not decompress gz stream Connection closed while receiving
data, path = '')
  • 原因:运行了flutter cleanflutter pub cache repair,然后翻墙后导致的问题
  • 解决方法:国情问题,你们懂得
  • 效果:本次运行有效,可能有特殊适用性,待以后更多结果反馈
  • 发现时间:2020.11.12
  • 更新时间:2020.11.12

Error: ADB exited with exit code 1

Error: ADB exited with exit code 1
Performing Streamed Install

adb: failed to install /Users/vadxq/xx/xxx/build/app/outputs/flutter-apk/app.apk:
Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries,
res=-113]
Error launching application on Android SDK built for x86 64.
  • 原因:所安装的SDK版本问题
  • 解决方法:重新下一个对应的就好,Android Studio推荐的就好了
  • 效果:本次运行有效,可能有特殊适用性,待以后更多结果反馈
  • 发现时间:2020.11.12
  • 更新时间:2020.11.12

FlutterLoader( 4962): Flutter initialization failed. couldn’t find “libflutter.so”

FlutterLoader( 4962): Flutter initialization failed.
FlutterLoader( 4962): java.util.concurrent.ExecutionException: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/base.apk"],nativeLibraryDirectories=[/data/app/lib/arm, /data/app/base.apk!/lib/armeabi-v7a, /system/lib]]] couldn't find "libflutter.so"
  • 原因:所安装的虚拟机的系统架构问题,x86架构和arm64架构

  • 解决方法:

    • 下载对应的架构虚拟机,如果没有就只能用真机

    • build.gradle添加配置

      android { ... defaultConfig { .... ndk { abiFilters 'armeabi-v7a', 'x86' } }
  • 效果:可行

  • 发现时间:2020.11.12

  • 更新时间:2020.11.12

对应IOS零散报错以及经历的解决方法

前提安装好环境,见【Flutter安装】2020年末flutter安装找坑排坑

Analyzing dependencies pod install 安装问题

Analyzing dependencies

Inspecting targets to integrate
Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
# 开启终端翻墙,在终端窗口添加即可,不同的翻墙方式,端口不太一样,我这是v2ray
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890
  • 原因:网络问题下载失败了
  • 解决方法:开启终端翻墙
  • 效果:可行,下载速度飙升,我的只花了半分钟就好了
  • 发现时间:2020.11.12
  • 更新时间:2020.11.13

Error connecting to the service protocol: failed to connect to

Error connecting to the service protocol: failed to connect to
http://127.0.0.1:61773/xxxxx=/
  • 原因:前一步开启终端翻墙后,设置了代理
  • 解决方法:将终端的代理关了,或者新开一下窗口
  • 效果:可行
  • 发现时间:2020.11.13
  • 更新时间:2020.11.13

关于groot flutter项目初接触启动总结

  • 首先是看sdk版本和jdk版本已经创建对应的虚拟机是否和项目的对应,下载avd要提前对应相应的sdk
  • 其次查看是否出现项目设定了支持系统的架构问题
  • 然后遇到问题再继续探查

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK