build: fix android
This commit is contained in:
parent
2469d3f021
commit
cbb022ac50
1 changed files with 15 additions and 7 deletions
|
@ -39,21 +39,29 @@ type=$1
|
||||||
[[ $2 == "v8" ]] && rustup target install aarch64-linux-android
|
[[ $2 == "v8" ]] && rustup target install aarch64-linux-android
|
||||||
|
|
||||||
# Build native code
|
# Build native code
|
||||||
export CPPFLAGS="-DMDB_USE_ROBUST=0" && export CFLAGS="-DMDB_USE_ROBUST=0" \
|
mkdir -p android/app/src/main/jniLibs
|
||||||
&& cargo ndk -t ${arch} build ${release_param[@]}
|
cargo install cargo-ndk
|
||||||
|
cargo ndk -t ${arch} -o android/app/src/main/jniLibs build ${release_param}
|
||||||
|
|
||||||
# Build Android application and launch at all connected devices
|
# Build Android application and launch at all connected devices
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
yes | mkdir -p android/app/src/main/jniLibs/${arch} && cp -f target/${platform}/${type}/libgrim.so android/app/src/main/jniLibs/${arch}
|
|
||||||
cd android
|
cd android
|
||||||
|
|
||||||
|
# Setup gradle argument
|
||||||
|
[[ $1 == "release" ]] && gradle_param+=(assembleRelease)
|
||||||
|
[[ $1 == "debug" ]] && gradle_param+=(build)
|
||||||
|
|
||||||
./gradlew clean
|
./gradlew clean
|
||||||
# ./gradlew assembleRelease
|
./gradlew ${gradle_param}
|
||||||
./gradlew build
|
|
||||||
|
# Setup apk path
|
||||||
|
[[ $1 == "release" ]] && apk_path+=(app/build/outputs/apk/release/app-release.apk)
|
||||||
|
[[ $1 == "debug" ]] && apk_path+=(app/build/outputs/apk/debug/app-debug.apk)
|
||||||
|
|
||||||
for SERIAL in $(adb devices | grep -v List | cut -f 1);
|
for SERIAL in $(adb devices | grep -v List | cut -f 1);
|
||||||
do
|
do
|
||||||
# adb -s $SERIAL install app/build/outputs/apk/release/app-release.apk
|
adb -s $SERIAL install ${apk_path}
|
||||||
adb -s $SERIAL install app/build/outputs/apk/debug/app-debug.apk
|
|
||||||
sleep 1s
|
sleep 1s
|
||||||
adb -s $SERIAL shell am start -n mw.gri.android/.MainActivity;
|
adb -s $SERIAL shell am start -n mw.gri.android/.MainActivity;
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue