问题汇总-持续更新
一起从0开始Flutter实战!
项目开始了,我们把已经搭建的框架运行一下,果然有报错的出现,我们先看下第一个出现的异常:
What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not resolve io.flutter:flutter_embedding_debug:1.0.0-6bc433c6b6b5b98dcf4cc11aff31cdee90849f32.
Required by:
project :app
project :app > project :shared_preferences
project :app > project :sqflite
> Skipped due to earlier error
> Skipped due to earlier error
> Skipped due to earlier error
这里的异常是因为我们在项目的配置没有配置完整,我们来看下解决方法:
打开android/build.gradle文件添加:
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
maven {
url 'http://download.flutter.io'
}
maven { url "https://jitpack.io" }
}
}
问题二:
* What went wrong:
Execution failed for task ':app:stripDebugDebugSymbols'.
No version of NDK matched the requested version 21.0.6113669. Versions available locally: 20.0.5594570, 21.2.6472646
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.
问题原因我们NDK本地有多个版本可选,所以我们可以指定版本,在android/app/build.gradle文件中修改:
android {
compileSdkVersion 28
ndkVersion "21.2.6472646"
}
增加指定版本。
------------------------------------ 分割线 ------------------------------------
以后会持续在本文后面追加遇到的问题,作为问题归结,方便查找,新的知识会单独去开文章来写。