yii.
← Writing
開發筆記 · · 1 min read

Flutter | 問題 | 產出Android AppBundle卡住了(has different version for the compile (1.0.0) and runtime (1.0.1) classpath)

這篇寫於 2019 年。工具和 API 變化很快,部分步驟可能已經不適用。

紀錄開發時發現的問題

原因#

執行 Flutter build appbundle -v 要產出AppBundle準備上架Android App,但是過程中發現問題

解決#

1.在 android/gradle.properties 檔案,加入以下:

android.enableJetifier=true
android.useAndroidX=true

2.在 android/app/build.gradle 檔案,修改以下:

make sure compileSdkVersion and targetSdkVersion are at least 28.
testInstrumentationRunner “androidx.test.runner.AndroidJUnitRunner”

3.在 android/app/build.gradle 檔案,在defaultConfig加上以下:

multiDexEnabled true

最後就能正常產出AppBundle拉~

參考#

  1. https://blog.csdn.net/m0_37714581/article/details/89400972

本文原刊登於 Medium。