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

E2E script to run on Android emulator #117

Merged
merged 2 commits into from
Apr 11, 2024
Merged

E2E script to run on Android emulator #117

merged 2 commits into from
Apr 11, 2024

Conversation

kirklandsign
Copy link
Contributor

No description provided.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 10, 2024
Copy link
Contributor

@mikekgfb mikekgfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

./gradlew :app:build
popd

avdmanager create avd --name "llama-fast" --package "system-images;android-34;aosp_atd;arm64-v8a"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should update to google_apis


adb adb wait-for-device
adb shell mkdir /data/local/tmp/llama
adb push model.pte /data/local/tmp/llama
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use stories15M.pte for example.

if [ "$(uname)" == "Darwin" -a "$(uname -p)" == "arm" ]; then
JAVA_URL="https://download.oracle.com/java/17/archive/jdk-17.0.10_macos-aarch64_bin.tar.gz"
SDK_MANAGER_URL="https://dl.google.com/android/repository/commandlinetools-mac-11076708_latest.zip"
elif [ "$(uname)" == "Linux" -a "$(uname -p)" == "x86_64" ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uname -m instead

if [ "$(uname)" == "Darwin" -a "$(uname -p)" == "arm" ]; then
export JAVA_HOME="$(pwd)"/jdk-17.0.10.jdk/Contents/Home
export PATH="$JAVA_HOME/bin:$PATH"
elif [ "$(uname)" == "Linux" -a "$(uname -p)" == "x86_64" ]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uname -m

sdkmanager --sdk_root="${ANDROID_HOME}" --install "platform-tools"
export ANDROID_NDK="$ANDROID_HOME/ndk/25.0.8775105"
sdkmanager --sdk_root="${ANDROID_HOME}" --install "emulator"
sdkmanager --sdk_root="${ANDROID_HOME}" --install "system-images;android-34;google_apis;arm64-v8a"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe android-26

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Let's just use x86_64 img on x86_64...

adb shell mkdir /data/local/tmp/llama
adb push model.pte /data/local/tmp/llama
adb push tokenizer.bin /data/local/tmp/llama
adb install -t app/build/outputs/apk/debug/app-debug.apk
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path should be build/src/executorch/examples/demo-apps/android/LlamaDemo/app/build/outputs/apk/debug/app-debug.apk

curl "${SDK_MANAGER_URL}" -o commandlinetools.zip

echo "Unzip Android SDK Manager"
unzip commandlinetools.zip
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read https://developer.android.com/tools/sdkmanager to set up that directory :(

avdmanager create avd --name "llama-fast" --package "system-images;android-34;aosp_atd;arm64-v8a"
sdk/emulator/emulator -sysdir $ANDROID_SDK_ROOT/system-images/android-34/google_apis/arm64-v8a/ @llama-fast &

adb adb wait-for-device
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adb


export ANDROID_HOME="$(realpath ./sdk)"
export ANDROID_SDK_ROOT="$ANDROID_HOME"
yes | sdkmanager --sdk_root="${ANDROID_HOME}" --licenses
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed

@kirklandsign kirklandsign merged commit fd5d207 into main Apr 11, 2024
5 of 8 checks passed
@kirklandsign kirklandsign deleted the android-example branch April 11, 2024 17:42
malfet pushed a commit that referenced this pull request Jul 17, 2024
* E2E script to run on Android emulator

* Simplify stuff
malfet pushed a commit that referenced this pull request Jul 17, 2024
* E2E script to run on Android emulator

* Simplify stuff
malfet pushed a commit that referenced this pull request Jul 17, 2024
* E2E script to run on Android emulator

* Simplify stuff
malfet pushed a commit that referenced this pull request Jul 17, 2024
* E2E script to run on Android emulator

* Simplify stuff
malfet pushed a commit that referenced this pull request Jul 17, 2024
* E2E script to run on Android emulator

* Simplify stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants