android - 构建 Flutter Android 应用时 AppCenter 构建崩溃
问题描述
我正在使用 AppCenter 构建 Flutter Android 应用程序。
我有以下从这里获取的构建脚本
#!/usr/bin/env bash
#Place this script in project/android/app/
cd ..
# fail if any command fails
set -e
# debug log
set -x
cd ..
git clone -b dev https://github.com/flutter/flutter.git
export PATH=`pwd`/flutter/bin:$PATH
flutter doctor
echo "Installed flutter to `pwd`/flutter"
flutter build apk --release
#copy the APK where AppCenter will find it
mkdir -p android/app/build/outputs/apk/; mv build/app/outputs/apk/release/app-release.apk $_
以下是构建日志的摘录:
...
Downloading ios-deploy... 0.4s
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.9.7, on Mac OS X 10.14.6 18G87, locale en)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[!] Android Studio (not installed)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
++ pwd
+ echo 'Installed flutter to /Users/vsts/agent/2.155.1/work/1/s/flutter'
+ flutter build apk --release
Installed flutter to /Users/vsts/agent/2.155.1/work/1/s/flutter
Running "flutter pub get" in s... 4.1s
You are building a fat APK that includes binaries for android-arm, android-arm64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Initializing gradle...
Sending crash report to Google.
...
看起来 AppCenter 无法初始化 Gradle。有什么建议么?.gitignore 文件:
# Android related
#**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
#**/android/gradlew
#**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
解决方案
我也面临着类似的问题。另一种方法是将 apk 发布到 appcenter 的发布部分。
推荐阅读
- postgresql - Dockerized ThingsBoard + Dockerized PostgreSQL
- typescript - Typescript 私有属性子类无法访问
- here-api - HERE 地图调整卡车配置文件
- php - 在 PHP 7 中使用变量实例化对象
- stanford-nlp - Stanford Core NLP 是否支持俄语句子和单词标记化?
- audio - 合并两个数字声音文件
- python - 负维度大小由 1 减去 2 导致的 'conv2d_2/convolution' (op: 'Conv2D') 输入形状:[?,174,1,40], [2,2,40,16]
- spring - Spring JPA Hibernate - 如何访问多对多表和连接表?
- c++ - C++ 将 UTF-8 转换为字符串
- r - 如何在从 R 中的字符向量动态创建的轴标签中使用上标?