Can't download Android Platform for SDK 27

We have this in our circle.yml:

if [ ! -d "/usr/local/android-sdk-linux/platforms/android-26" ]; then echo y | android update sdk --no-ui --all --filter "android-26"; fi

(full file here: https://github.com/facebook/fresco/blob/master/circle.yml)

This works nicely. However, when trying to update to 27, this command fails with:

Installing Archives:
  Preparing to install archives
  Downloading SDK Platform Android 8.1.0, API 27, revision 1
  Download finished with wrong size. Expected 65606517 bytes, got 65738431 bytes.
  Done. Nothing was installed.

I’m guessing the wrong thing is cached somewhere, maybe? Anyone else hitting this? How to get around it?

EDIT: just realized Google’s repository.xml has two entries for API 27, pointing to the same file, with different hashes / sizes. The sizes are exactly the ones that the android update sdk command complains about:

<sdk:platform>
	<!--
Generated from bid:4458339, branch:git_oc-mr1-sdk-release
-->
	<sdk:version>8.1.0</sdk:version>
	<sdk:api-level>27</sdk:api-level>
	<sdk:description>Android SDK Platform 27</sdk:description>
	<sdk:revision>1</sdk:revision>
	<sdk:archives>
		<sdk:archive>
			<!-- Built on: Fri Nov 17 16:30:06 2017. -->
			<sdk:size>65606517</sdk:size>
			<sdk:checksum type="sha1">4a96116ef84ce7b10745b31715d2ee2b92ed70ae</sdk:checksum>
			<sdk:url>platform-27_r01.zip</sdk:url>
		</sdk:archive>
	</sdk:archives>
	<sdk:uses-license ref="android-sdk-license"/>
	<sdk:min-tools-rev>
		<sdk:major>22</sdk:major>
	</sdk:min-tools-rev>
	<sdk:desc-url>http://developer.android.com/sdk/</sdk:desc-url>
	<sdk:layoutlib>
		<sdk:api>15</sdk:api>
		<sdk:revision>1</sdk:revision>
	</sdk:layoutlib>
</sdk:platform>
<sdk:platform>
	<!--
Generated from bid:4402310, branch:git_oc-mr1-release
-->
	<sdk:version>8.1.0</sdk:version>
	<sdk:api-level>27</sdk:api-level>
	<sdk:description>Android SDK Platform 27</sdk:description>
	<sdk:revision>1</sdk:revision>
	<sdk:archives>
		<sdk:archive>
			<!-- Built on: Wed Nov  8 11:00:15 2017. -->
			<sdk:size>65738431</sdk:size>
			<sdk:checksum type="sha1">dfda0862550768ed04a4fb0e03c322230aff9fdc</sdk:checksum>
			<sdk:url>platform-27_r01.zip</sdk:url>
		</sdk:archive>
	</sdk:archives>
	<sdk:uses-license ref="android-sdk-license"/>
	<sdk:min-tools-rev>
		<sdk:major>22</sdk:major>
	</sdk:min-tools-rev>
	<sdk:desc-url>http://developer.android.com/sdk/</sdk:desc-url>
	<sdk:layoutlib>
		<sdk:api>15</sdk:api>
		<sdk:revision>1</sdk:revision>
	</sdk:layoutlib>
</sdk:platform>

Were you ever able to get this resolved?

Nope. We skipped trying to upgrade our target sdk because of this. Error
seems to be Google’s part, but unsure where to report it…

Ouch. Are you building on 1.0 or 2.0?

It looks like the fix is to use the new sdkmanager tool to update. This is described here:

Unfortunately the 1.0 images don’t come with the Android SDK (25.2.3 and higher) that introduces sdkmanager.

I ran into this today on Circle 1.0. I would update to 2.0 but I don’t believe there are any Pre-Built Android images provided by Circle right now? Is that true? I’m reading through the list of these images:
https://circleci.com/docs/2.0/circleci-images/

Nvm looks like there is an Android sample project up: https://circleci.com/docs/2.0/language-android/

2 Likes