Search code examples
androidandroid-source

Running AOSP build on Mac (Yosemite and later)


I was able to get the source code for android-5.0.1_r1 into my working directory. However, I have trouble building and running the code on an emulator because the lunch command is giving me trouble.

repo has been initialized in /Volumes/AOSPDiskImage/AOSP
Nikhils-MBP:AOSP Nikhil$ . build/envsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/fugu/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/moto/shamu/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including sdk/bash_completion/adb.bash
Nikhils-MBP:AOSP Nikhil$ lunch

You're building on Darwin

Lunch menu... pick a combo:
 1. aosp_arm-eng
 2. aosp_arm64-eng
 3. aosp_mips-eng
 4. aosp_mips64-eng
 5. aosp_x86-eng
 6. aosp_x86_64-eng
 7. aosp_deb-userdebug
 8. aosp_flo-userdebug
 9. full_fugu-userdebug
 10. aosp_fugu-userdebug
 11. aosp_grouper-userdebug
 12. aosp_tilapia-userdebug
 13. mini_emulator_arm64-userdebug
 14. mini_emulator_arm-userdebug
 15. mini_emulator_mips-userdebug
 16. mini_emulator_x86-userdebug

Which would you like? [aosp_arm-eng]

Everytime, I picked one of the options I kept getting a message that looks like:

Which would you like? [aosp_arm-eng] 6
build/core/combo/mac_version.mk:38:          
*****************************************************
build/core/combo/mac_version.mk:39: * Can not find SDK 10.6 at  
/Developer/SDKs/MacOSX10.6.sdk
build/core/combo/mac_version.mk:40: 
*****************************************************
build/core/combo/mac_version.mk:41: *** Stop..  Stop.

** Don't have a product spec for: 'aosp_x86_64'
** Do you have the right repo manifest?

What am I missing? What should I do?


Solution

  • Assuming you're encountering this issue on Yosemite, it's a known issue.

    While there's no official workaround at the moment, assuming you have XCode installed, you should be able to fix it by symlinking your current SDK:

    sudo ln -s /Developer/SDKs/MacOSX10.10.sdk /Developer/SDKs/MacOSX10.6.sdk
    

    And then modifying build/core/combo/mac_version.mk, and changing:

    mac_sdk_versions_supported := 10.6 10.7 10.8

    to

    mac_sdk_versions_supported := 10.9 10.10

    It's simply an issue with Xcode versioning and the way it was previously hardcoded into the build process.