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 #10 Licenses Are Not Accepted #11

Merged
merged 1 commit into from
Mar 12, 2020
Merged
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ The `config.sh` file is the central point for configuring the behavior of the pi
| `commandLineToolsDownloadUrlPattern` | Regex pattern used to extract the latest Command Line Tools from the Android Studio download page. | String | :x: |
| `emulatorBootedSleepTime` | How long to wait, in seconds, after the emulator's boot has finished to ensure the launcher is visible and ready for user interaction. | Integer | :x: |
| `jdkPattern` | Regex pattern used to identify the latest JDK 8 build available from SDKMan. | String | :x: |
| `sdkManagerWaitTime` | How long to wait, in seconds, as commands to the `sdkmanager` are made. Useful for automatically accepting any licenses without hanging the process. | Integer | :x: |
| `startEmulatorTimeout` | How long to wait, in seconds, before assuming the Android Emulator will not or did not properly start. | Integer | :x: |

Feel free to open the `setup-emulator.sh` and `setup-host.sh` files to see each of the steps which run, and enable or disable them according to your needs.
Expand Down
12 changes: 0 additions & 12 deletions config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,6 @@ emulatorBootedSleepTime=30
# from SDKMan. More info on versions here: https://bit.ly/2SCGEnb
jdkPattern="8\.0\.[0-9][0-9][0-9]\.hs\-adpt"

# How long to wait, in seconds for the SDKManager to complete an
# operation. This number also indicates how many times to send a
# "y" to the manager, in case it asks for end-user license
# acceptance. Adjust based on your experiments/requirements.
#
# Please note that your builds will be longer, since each
# SDKManager operations will take at least these many seconds. It
# does, however, prove itself to be very reliable in a hands-
# off scenario to handle all of the SDK's prompts. So, keep that
# in mind as you adjust this number.
sdkManagerWaitTime=90

# How long to wait, in seconds, before timing out and assuming
# that the emulator will not start. Adjust based on your
# experiments/requirements.
Expand Down
8 changes: 6 additions & 2 deletions emulator/create-avd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ else
imageName="system-images;android-$androidSdkVersion;google_apis;x86"
fi

(for run in {1..1000}; do echo y; done) >> yep.txt

echo "Obtaining image: $imageName"
(for run in {1..$sdkManagerWaitTime}; do sleep 1; echo y 2>/dev/null; done) | sdkmanager $imageName >> /dev/null
cat ./yep.txt | sdkmanager $imageName >> /dev/null
echo "Obtained"

echo "Accepting any remaining licenses"
(for run in {1..$sdkManagerWaitTime}; do sleep 1; echo y 2>/dev/null; done) | sdkmanager --licenses
cat ./yep.txt | sdkmanager --licenses
echo "All licenses accepted"

rm ./yep.txt

# Create the AVD
echo "Creating AVD: $emulatorDeviceName"

Expand Down
8 changes: 4 additions & 4 deletions host/create-paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ echo "==========================="
echo

# Create the file
echo "export ANDROID_HOME=$installDestination/cmdline-tools/latest/" >> "$currentDir/paths.sh"
echo "export ANDROID_HOME=$installDestination" >> "$currentDir/paths.sh"
echo -n 'PATH=$PATH:' >> "$currentDir/paths.sh"
echo "$installDestination/cmdline-tools/latest/bin/" >> "$currentDir/paths.sh"
echo "$installDestination/cmdline-tools/latest/bin" >> "$currentDir/paths.sh"
echo -n 'PATH=$PATH:' >> "$currentDir/paths.sh"
echo "$installDestination/emulator/" >> "$currentDir/paths.sh"
echo "$installDestination/emulator" >> "$currentDir/paths.sh"
echo -n 'PATH=$PATH:' >> "$currentDir/paths.sh"
echo "$installDestination/platform-tools/" >> "$currentDir/paths.sh"
echo "$installDestination/platform-tools" >> "$currentDir/paths.sh"

echo "File created"
cat "$currentDir/paths.sh"
Expand Down
10 changes: 7 additions & 3 deletions host/install-android-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ mkdir -p "$HOME/.android"
touch "$HOME/.android/repositories.cfg"

# Install the SDKs
(for run in {1..1000}; do echo y; done) >> yep.txt

echo "SDKManager license"
(for run in {1..$sdkManagerWaitTime}; do sleep 1; echo y 2>/dev/null; done) | sdkmanager --update
cat ./yep.txt | sdkmanager --update
echo "License accepted"

echo "Obtaining the platform tools and API $androidSdkVersion tools"
(for run in {1..$sdkManagerWaitTime}; do sleep 1; echo y 2>/dev/null; done) | sdkmanager "platform-tools" "platforms;android-$androidSdkVersion" >> /dev/null
cat ./yep.txt | sdkmanager "platform-tools" "platforms;android-$androidSdkVersion" >> /dev/null
echo "Finished obtaining tools"

echo "Accepting any remaining licenses"
(for run in {1..$sdkManagerWaitTime}; do sleep 1; echo y 2>/dev/null; done) | sdkmanager --licenses || { status=$?; echo "Done"; }
cat ./yep.txt | sdkmanager --licenses
echo "All licenses accepted"

rm ./yep.txt