日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

flutter ios打包_使用 Travis CI 为 Flutter 项目打包 Android/iOS 应用

發布時間:2025/3/15 Android 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 flutter ios打包_使用 Travis CI 为 Flutter 项目打包 Android/iOS 应用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Travis CI 構建

Building Flutter APKs and IPAs on Travis 這篇文章詳細介紹了如何在 Travis CI 上為 Flutter 項目打包 Android/iOS 應用,不過實際構建時存在幾個問題,原文中的 .travis.yml 配置如下:

matrix:include:- os: linuxlanguage: androidlicenses:- 'android-sdk-preview-license-.+'- 'android-sdk-license-.+'- 'google-gdk-license-.+'android:components:- tools- platform-tools- build-tools-25.0.3- android-25- sys-img-armeabi-v7a-google_apis-25- extra-android-m2repository- extra-google-m2repository- extra-google-android-supportjdk: oraclejdk8sudo: falseaddons:apt:# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18sources:- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong versionpackages:- libstdc++6- fonts-droidbefore_script:- wget http://services.gradle.org/distributions/gradle-3.5-bin.zip- unzip -qq gradle-3.5-bin.zip- export GRADLE_HOME=$PWD/gradle-3.5- export PATH=$GRADLE_HOME/bin:$PATH- git clone https://github.com/flutter/flutter.git -b alpha --depth 1script:- ./flutter/bin/flutter -v build apk- os: osxlanguage: genericosx_image: xcode8.3before_script:- pip install six- brew update- brew install --HEAD libimobiledevice- brew install ideviceinstaller- brew install ios-deploy- git clone https://github.com/flutter/flutter.git -b alpha --depth 1script:- ./flutter/bin/flutter -v build ios --no-codesigncache:directories:- $HOME/.pub-cache

Android

wget - 403 Forbidden

這個錯誤發生在執行 wget http://services.gradle.org/distributions/gradle-3.5-bin.zip 的時候,把 gradle 的下載路徑替換成 https 即可。

Remote branch alpha not found in upstream origin

這個錯誤發生在下載 Flutter 代碼的階段,原文中的配置會下載 Flutter 的 alpha 分支代碼,但是目前 Flutter 的倉庫已經沒有 alpha 分支,切換到 stable 分支即可,即:git clone https://github.com/flutter/flutter.git -b stable --depth 1。

Failed to install the following Android SDK packages as some licences have not been accepted

詳細錯誤信息如下:

[ ] > Failed to install the following Android SDK packages as somelicences have not been accepted.[ ] build-tools;28.0.3 Android SDK Build-Tools 28.0.3[ ] platforms;android-29 Android SDK Platform 29[ ] To build this project, accept the SDK license agreements andinstall the missing components using the Android Studio SDK Manager.

這個錯誤是由于沒有同意 Android SDK 的許可證協議,在 before_script 中加入如下配置即可:

yes | sdkmanager "platforms;android-29" yes | sdkmanager "build-tools;28.0.3"

iOS

pip: command not found

這個錯誤在執行 pip install six 時遇到,經過實際驗證構建 iOS 應用時并不需要此行配置,所以刪掉即可。

Xcode 11.0 or greater is required to develop for iOS

原文中的配置使用的是 Xcode 8.3,最后打包時會提示此錯誤,將 osx_image 設置為 xcode11 即可。

最后完整可用的 .travis.yml 配置如下:

matrix:include:- os: linuxlanguage: androidlicenses:- 'android-sdk-preview-license-.+'- 'android-sdk-license-.+'- 'google-gdk-license-.+'android:components:- tools- platform-tools- build-tools-25.0.3- android-25- sys-img-armeabi-v7a-google_apis-25- extra-android-m2repository- extra-google-m2repository- extra-google-android-supportjdk: oraclejdk8sudo: falseaddons:apt:# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18sources:- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong versionpackages:- libstdc++6- fonts-droidbefore_script:- wget https://services.gradle.org/distributions/gradle-3.5-bin.zip- unzip -qq gradle-3.5-bin.zip- export GRADLE_HOME=$PWD/gradle-3.5- export PATH=$GRADLE_HOME/bin:$PATH- git clone https://github.com/flutter/flutter.git -b stable --depth 1- yes | sdkmanager "platforms;android-29"- yes | sdkmanager "build-tools;28.0.3"script:- ./flutter/bin/flutter -v build apk- os: osxlanguage: genericosx_image: xcode11before_script:- brew update- brew install --HEAD libimobiledevice- brew install ideviceinstaller- brew install ios-deploy- git clone https://github.com/flutter/flutter.git -b stable --depth 1script:- ./flutter/bin/flutter -v build ios --no-codesigncache:directories:- $HOME/.pub-cache

完整的代碼可參考 flutter-travis-build-demo。

Codemagic

最后推薦 Codemagic 這個服務,提供云端打包 Flutter 應用的功能,省去了 Travis CI 配置的步驟,免費用戶每月有500分鐘的額度來執行構建。

參考:

  • Building Flutter APKs and IPAs on Travis
  • Failed to install the following Android SDK packages as some licences have not been accepted in jitpack

總結

以上是生活随笔為你收集整理的flutter ios打包_使用 Travis CI 为 Flutter 项目打包 Android/iOS 应用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。