Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #13 Add Support for M1 Macs #14

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 65 additions & 12 deletions config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,24 @@
# Configuration to personalize your emulator #
##############################################

##############################################
# For Android Phone and Tablet emulators only
#
# Not for Android TV (Google TV)
# Not for Android Wear (Wear OS)
# Not for Android Automotive
# Not for Chrome OS
##############################################

# Android SDK API level. See full list of API levels here:
# https://source.android.com/setup/start/build-numbers
androidSdkVersion="29"
#
# Please note that pre-release versions use letters as the
# release name before it is generally avaiable. For example,
# Android 11 (API 30) was known as R before it was released.
# If you need a pre-release version, use the version letter
# here.
androidSdkVersion="30"

# Sets up the screen resolution, RAM, and other device options
# to closely match the behavior, specifications, and performance
Expand All @@ -18,31 +33,69 @@ androidSdkVersion="29"
#
# To see the supported profiles, type: avdmanager list device
#
# The avdmanager is available inside of the Command Line tools
# ZIP package as provided at https://developer.android.com/studio
#
# Use the "ID" as the deviceProfile, below. For example, for
# the original Pixel XL, you will see this as an entry when
# the Google Pixel 4 XL, you will see this as an entry when
# running the above command:
#
# id: 19 or "pixel_xl"
# Name: Pixel XL
# OEM : Google
# id: 23 or "pixel_4_xl"
# Name: Pixel 4 XL
# OEM : Google
#
# Just use the ID, "pixel_xl", in this case.
deviceProfile="pixel_xl"
# Just use the ID, "pixel_4_xl", in this case.
deviceProfile="pixel_4_xl"

# Name of the AVD, can be anything you desire. Just remember it
# for later when you need to start it up for testing.
emulatorDeviceName="Device"

# Configures the host platform. Valid values are either "mac"
# or "linux".
#hostType="linux"
hostType="mac"

# Google ships different versions of their AVDs to support different
# host chipset architectures. For example, newer M1-based Macs require
# an ARM-based AVD to work properly, while Intel-based machines should
# use x86 or x86_64 images.
#
# Please note that Google does not ship all combinations of their AVDs
# for all architectures. For instance, there isn't an ARM-based image
# available for API 30, but there is for API 31. If you need an idea of
# what Google has available for your architecture, run this command from
# your terminal: sdkmanager --list
#
# The sdkmanager is available inside of the Command Line tools
# ZIP package as provided at https://developer.android.com/studio
#
# As of 06/22/21, Google provides Android phone and tablet AVDs for 4
# architectures:
# - x86 (API 10 - API 30)
# - x86_64 (API 21+)
# - arm64-v8a (Sparodic support since API 24)
# - armeabi-v7a (API 10 - API 25)
#
# For M1-based Macs you need the arm64-v8a image.
# For Intel-based Macs and most Linux hardware, you need either the x86
# or the x86_64 image.
#
# Valid values are "x86", "x86_64", "arm64-v8a", or "armeabi-v7a".
hostArchitecture="arm64-v8a"

# Whether or not to include the Google Play store when setting
# up the emulator. All x86 images down to API 24 and x86_64
# images down to API 28 can support the Google Play Store.
# Please note that this framework assumes you are building x86
# emulators. See more information by runing: sdkmanager --list
# up the emulator. As of 06/22/21, here is the support landscape for
# AVDs with Google Play installed:
# - x86 (API 24+)
# - x86_64 (API 28+)
# - arm64-v8a (API 31+)
# - armeabi-v7a (No support)
#
# For more information, run this command from your terminal:
# sdkmanager --list
#
# The sdkmanager is available inside of the Command Line tools
# ZIP package as provided at https://developer.android.com/studio
includePlayStore=false

# Location to install the Android Command Line tools, and all
Expand Down
6 changes: 3 additions & 3 deletions emulator/create-avd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ imageName=""

if ( $includePlayStore ); then
echo "Including the Google Play Store in the AVD"
imageName="system-images;android-$androidSdkVersion;google_apis_playstore;x86"
imageName="system-images;android-$androidSdkVersion;google_apis_playstore;$hostArchitecture"
else
echo "Not including the Google Play Store in the AVD"
imageName="system-images;android-$androidSdkVersion;google_apis;x86"
imageName="system-images;android-$androidSdkVersion;google_apis;$hostArchitecture"
fi

(for run in {1..1000}; do echo y; done) >> yep.txt
Expand All @@ -36,7 +36,7 @@ rm ./yep.txt
echo "Creating AVD: $emulatorDeviceName"

avdmanager create avd \
--abi google_apis/x86 \
--abi "google_apis/$hostArchitecture" \
--device "$deviceProfile" \
--force \
--name "$emulatorDeviceName" \
Expand Down
2 changes: 1 addition & 1 deletion emulator/fix-google-maps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo

# Open Google Maps and dismiss the on-boarding prompt
echo "Opening Google Maps"
adb shell 'monkey -p com.google.android.apps.maps -c android.intent.category.LAUNCHER 1'
adb shell 'am start com.google.android.apps.maps'
sleep 5

echo "Dismissing the On-Boarding prompt"
Expand Down
2 changes: 1 addition & 1 deletion host/install-android-command-line-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ unzip -q android.zip -d ./android-temp
echo "Extraction complete"

mkdir -p "$installDestination/cmdline-tools/latest"
mv ./android-temp/tools/* "$installDestination/cmdline-tools/latest"
mv ./android-temp/cmdline-tools/* "$installDestination/cmdline-tools/latest"
rm -rf ./android-temp
rm android.zip

Expand Down
2 changes: 1 addition & 1 deletion host/install-android-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ source "$currentDir/../config.sh"

echo
echo "==========================="
echo "Install Android Command Line Tools"
echo "Install Android SDK and Platform Tools"
echo "==========================="
echo

Expand Down