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
|
||||
|
||||
# Build native code
|
||||
export CPPFLAGS="-DMDB_USE_ROBUST=0" && export CFLAGS="-DMDB_USE_ROBUST=0" \
|
||||
&& cargo ndk -t ${arch} build ${release_param[@]}
|
||||
mkdir -p android/app/src/main/jniLibs
|
||||
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
|
||||
if [ $? -eq 0 ]
|
||||
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
|
||||
|
||||
# Setup gradle argument
|
||||
[[ $1 == "release" ]] && gradle_param+=(assembleRelease)
|
||||
[[ $1 == "debug" ]] && gradle_param+=(build)
|
||||
|
||||
./gradlew clean
|
||||
# ./gradlew assembleRelease
|
||||
./gradlew build
|
||||
./gradlew ${gradle_param}
|
||||
|
||||
# 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);
|
||||
do
|
||||
# adb -s $SERIAL install app/build/outputs/apk/release/app-release.apk
|
||||
adb -s $SERIAL install app/build/outputs/apk/debug/app-debug.apk
|
||||
adb -s $SERIAL install ${apk_path}
|
||||
sleep 1s
|
||||
adb -s $SERIAL shell am start -n mw.gri.android/.MainActivity;
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue