Flutter實戰(二、問題彙總-持續更新)

問題彙總-持續更新

一起從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"
    }

增加指定版本。

------------------------------------ 分割線 ------------------------------------
以後會持續在本文後面追加遇到的問題,作爲問題歸結,方便查找,新的知識會單獨去開文章來寫。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章