Q1

报错信息

$ openssl aes-256-cbc -K $encrypted_d2e7c15ed967_key -iv $encrypted_d2e7c15ed967_iv -in mood.jks.enc -out mood.jks -d
bad decrypt
140442486961824:error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length:evp_enc.c:532:
The command "openssl aes-256-cbc -K $encrypted_d2e7c15ed967_key -iv $encrypted_d2e7c15ed967_iv -in mood.jks.enc -out mood.jks -d" failed and exited with 1 during.
Your build has been stopped.

错误原因

Caveat

There is a report of this function not working on a local Windows machine. Please use a Linux or OS X machine.

解决办法

在linux或mac os下运行travis encrypt-file mood.jks --add命令。

Q2

报错信息

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:microtears/asset_generator.git' into submodule path '/home/travis/build/microtears/Mood/asset_generator' failed
Failed to clone 'asset_generator'. Retry scheduled
Cloning into '/home/travis/build/microtears/Mood/asset_generator'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:microtears/asset_generator.git' into submodule path '/home/travis/build/microtears/Mood/asset_generator' failed
Failed to clone 'asset_generator' a second time, aborting
The command "eval git submodule update --init --recursive " failed. 

错误原因

使用git协议的地址时候,自动使用了publickey进行了验证,由于该publickey并没有添加到github账户上,所以Permission denied (publickey).

解决办法

如果项目中有submodule,则将其中所有使用git协议的url切换到https协议

Q3

报错信息

No file or variants found for asset: assets/flare.
[   +1 ms] Error building assets

错误原因

pubspec.yaml assets路径填写错误或者该路径下文件不存在。

解决办法

将路径修改为正确的路径,清除那些实际不存在文件的路径。

Q4

报错信息

> Configure project :app
File /home/travis/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 28.0.3 in /usr/local/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 28.0.3 not accepted.
Checking the license for package Android SDK Platform 28 in /usr/local/android-sdk/licenses
Warning: License for package Android SDK Platform 28 not accepted.


FAILURE: Build failed with an exception.

* Where:
Build file '/home/travis/build/microtears/Mood/android/build.gradle' line: 25

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Failed to install the following Android SDK packages as some licences have not been accepted.
   	build-tools;28.0.3 Android SDK Build-Tools 28.0.3
   	platforms;android-28 Android SDK Platform 28
   To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
   Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html

   Using Android SDK: /usr/local/android-sdk

   * 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.

   * Get more help at https://help.gradle.org

BUILD FAILED in 42s

错误原因

some licences have not been accepted.

解决办法

.travis.yml before_installs部分添加:

- touch $HOME/.android/repositories.cfg
- yes | sdkmanager "platforms;android-28"
- yes | sdkmanager "build-tools;28.0.3"

修改完成后如下:


···

before_install:
- touch $HOME/.android/repositories.cfg
- yes | sdkmanager "platforms;android-28"
- yes | sdkmanager "build-tools;28.0.3"

···

Q5

报错信息

0.00s$ touch $HOME/.android/repositories.cfg
0.01s$ yes | sdkmanager "platforms;android-28"
/home/travis/.travis/functions: line 104: sdkmanager: command not found
The command "yes | sdkmanager "platforms;android-28"" failed and exited with 127 during .

错误原因

没有导出相应的环境变量

解决办法

.travis.yml添加:dist: trusty,注意不要出现语法错误

Q6

报错信息

Travis CI 发布到Github Release的包没有包含apk

错误原因

apk文件被清理了

解决办法

.travis.yml deploy部分添加(注意provider为releases):

skip_cleanup: true

修改完成后如下:


···

deploy:
provider: releases
api_key:
  secure: ...
file: build/app/outputs/apk/release/app-release.apk
skip_cleanup: true
on:
  tags: true
  repo: microtears/Mood

···