问题
We are not using build tools "26.0.2" in our project. In fact, doing a grep -RF "26.0.2" . | grep -v android-profile
on our project directory does not return anything except for
./CBSandbox/build/intermediates/multi-dex/release/components.flags:-libraryjars /home/gabor/Android/Sdk/build-tools/26.0.2/lib/shrinkedAndroid.jar
./CBSandbox/build/intermediates/multi-dex/debug/components.flags:-libraryjars /home/gabor/Android/Sdk/build-tools/26.0.2/lib/shrinkedAndroid.jar
That in itself is bogus though, and it causes Travis to fail our build (Failed to find Build Tools revision 26.0.2
since our .travis.yml
specifies ANDROID_BUILD_TOOLS_VERSION=27.0.3
which we actually use). Is it a known multidex bug that an earlier tools version is pulled during multidexing? Note also that it's not during proguarding as CBSandbox has minifyEnabled false
in its build file (-libraryjars
in the output made me think of proguard).
We use the latest version of the gradle plugin which defaults to the latest build tools. But even if we manually specify the build tools, it still tries to pull an older version during multidex.
Edit: the build is still failing in Travis, but locally and in the Travis debug environment it succeeds:
travis@travis-job-76d0d0f4-b465-4926-b6fd-6496bbea6835:~/build/ChartBoost/android-sdk$ ./gradlew :CBSandbox:assemble
...
Checking the license for package Android SDK Build-Tools 26.0.2 in /usr/local/android-sdk/licenses
License for package Android SDK Build-Tools 26.0.2 accepted.
Preparing "Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)".
"Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)" ready.
Installing Android SDK Build-Tools 26.0.2 in /usr/local/android-sdk/build-tools/26.0.2
"Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)" complete.
"Install Android SDK Build-Tools 26.0.2 (revision: 26.0.2)" finished.
...
BUILD SUCCESSFUL in 3m 3s
So I guess it's both a Travis bug (fails on the UI while succeeding via SSH) and an Android tools bug (pulls older build tools without asking for that).
回答1:
Please add the link to the known Multidex bug and reproduce the bug in an open sample project.
Check this question, perhaps it helps.
you can add both in .travis.yml
file:
android:
components:
- build-tools-26.0.2
- build-tools-27.0.3
And manually specify the build tools version in your build.gradle
file:
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
I'm not sure if you are already doing it:
But even if we manually specify the build tools, it still tries to pull an older version during multidex.
来源:https://stackoverflow.com/questions/48508849/build-failing-in-travis-due-to-multidex-android-bug