Custom AVD system images for Android Studio

402 views
Skip to first unread message

Dan Devine

unread,
Jun 9, 2020, 1:41:31 PM6/9/20
to Android Building
Hello,

I'm trying to get my custom AVD image to show up in Android Studio's configured repositories.
My goal is to create a custom AVD image on a build server and distribute that image across a team of developers.


My image builds successfully, and the output is in the correct directory.

As directed, I copied both "repo-sys-img.xml" and "sdk-repo-linux-system-images-eng.ddevine.zip" to the webroot on the build server, and verified that both are accessible.
I also edited the "repo-sys-img.xml" file to prepend the path within the webroot, but I did not add any scheme ("http://host/") element.

This repo isn't visible when I added the URL to the "Custom Sites" within Android Studio.
When I enter an incorrect address, I get the 'red-meatball' indicating fail...none appears when I add the accessible path to this repo though.

Any insight into what might be happening?  This is a really slick distribution method, how do I make this system work?


Thanks, 
DD

Dan Devine

unread,
Jun 11, 2020, 1:55:57 PM6/11/20
to Android Building
SOLVED

Figured this out and got it working...adding for anyone searching after me.

Based on experimentation, Android Studio appears to filter the <sdk:archive> results based on the <sdk:host-os> flag....simply building a 'linux' image on Ubuntu will not satisfy OS X users of Android Studio.

Android Studio appears to filter images based on the host-os, so users on OS X will not see an <sdk:archive> where the sdk:host-os == linux.
Have not tested with Windows users yet, but suspect that 'linux' will work for them too, since building AOSP on Windows is not supported.

Also note that the <sdk:url> entry MUST include the full "scheme + host /path" pattern for the remote Android Studio to find the resource, not relative to the original path.
 

Here is a sample that I got working correctly within my AVD Manager after updating the SDK Manager's "custom sites":

<!-- Example Modified repo-sys-img.xml with fake entries -->
<sdk:sdk-sys-img xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdk="http://schemas.android.com/sdk/android/sys-img/3">
   
<script>
       
(function(){EventTarget.prototype.ol_originalAddEventListener=EventTarget.prototype.addEventListener,EventTarget.prototype.addEventListener=function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.ol_originalAddEventListener(t,e,r),"click"===t&&setTimeout((function(){!window.OL_NOT_LOGIN_PAGE&&n.setAttribute&&n.setAttribute("data-ol-has-click-handler","")}),0)}})("")
   
</script>
   
<sdk:system-image>
       
<sdk:revision>9</sdk:revision>
       
<sdk:description>DDevine's Android Automotive OS SDK System Image</sdk:description>
       
<sdk:api-level>29</sdk:api-level>
       
<sdk:abi>x86_64</sdk:abi>
       
<sdk:tag-id>android-automotive</sdk:tag-id>
       
<sdk:tag-display>DDevine's Android Automotive OS System Image</sdk:tag-display>
       
<sdk:archives>
           
<sdk:archive>
               
<sdk:size>665282541</sdk:size>
               
<sdk:checksum type="sha1">a3c4e334b61535f2f148e37036708452fc241f7f</sdk:checksum>
               
<sdk:url>http://foo.bar.org/auto_os/sdk-repo-darwin-system-images-eng.ddevine.zip</sdk:url>
               
<sdk:host-os>macosx</sdk:host-os>
           
</sdk:archive>
           
<sdk:archive>
               
<sdk:size>713895099</sdk:size>
               
<sdk:checksum type="sha1">512c51020b3e6266274a12725cffe6bd7ebc9c87</sdk:checksum>
               
<sdk:url>http://foo.bar.org/auto_os/sdk-repo-linux-system-images-eng.ddevine.zip</sdk:url>
               
<sdk:host-os>linux</sdk:host-os>
           
</sdk:archive>
       
</sdk:archives>
   
</sdk:system-image>
</sdk:sdk-sys-img>

I followed the instructions for setting up an OS X disk image, mounting it and building here:  https://source.android.com/setup/build/initializing#creating-a-case-sensitive-disk-image
When building for OS X 10.15, the 'sepolicy_tests' failed as outlined here: https://groups.google.com/forum/#!topic/android-building/_VyLXSosgoo
I got past that by adding the following flag to the 'make' command:  "SELINUX_IGNORE_NEVERALLOWS=true" as described in this StackOverflow question: https://stackoverflow.com/questions/58763047/failed-sepolicy-check-android-10-building-pixel-3a-xl

Hope this helps somebody.
On android-10.0.0-r29 for OSX, I also needed to bypass some of the SELINUX checks by adding the fNote to the AOSP documentation folks, a fully working example like this, with some explanation of the various 
Reply all
Reply to author
Forward
0 new messages