build.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. /home/cs/.jdks/corretto-1.8.0_432/bin/java -version
  3. SIG_PEM_DIR=/home/cs/Desktop/hd/as/wp/kekj/refs/apksign
  4. JAVA_CMD=/home/cs/.jdks/corretto-1.8.0_432/bin/java
  5. RELEASE_FILE_GROUP=/home/cs/Desktop/hd/as/wp/kekj/radar/新疆毫米波雷达V41
  6. #APK=$(pwd)/picturegrabbingsystem/build/outputs/apk/debug/picturegrabbingsystem-debug.apk
  7. APK=$(pwd)/picturegrabbingsystem/debug/picturegrabbingsystem-debug.apk
  8. #APK=/home/cs/Desktop/hd/as/wp/kekj/radar/yitihuaProjectSimpleCollectionKN/picturegrabbingsystem/debug/picturegrabbingsystem-debug.apk
  9. TIME=$(date +%Y%m%d_%H%M%S)
  10. echo "signed time $TIME"
  11. SIGNED_OUT_APK_NAME=signed_debug_"$TIME"
  12. SIGNED_OUT_APK=$SIGNED_OUT_APK_NAME.apk
  13. echo "apk path:"$APK
  14. ls -al $APK
  15. ls -al $SIGNED_OUT_APK
  16. rm signed_debug*
  17. echo "out apk:"$SIGNED_OUT_APK
  18. $JAVA_CMD -jar $SIG_PEM_DIR/signapk.jar $SIG_PEM_DIR/platform.x509.pem $SIG_PEM_DIR/platform.pk8 $APK $SIGNED_OUT_APK
  19. if [ $? -eq 0 ]; then
  20. echo "signed ok!"
  21. ls -al $(pwd)/$SIGNED_OUT_APK
  22. echo "the signed apk is here: "$(pwd)/$SIGNED_OUT_APK
  23. # check version configures
  24. #adb root
  25. #adb remount
  26. local HW_INDEX
  27. read -p "would you like to push configure.txt & setting.json?<y/n>: " HW_INDEX
  28. echo "your choice[ "$HW_INDEX " ]"
  29. if [ $HW_INDEX == y ]; then
  30. adb push $RELEASE_FILE_GROUP/configure.txt /storage/emulated/0/
  31. adb push $RELEASE_FILE_GROUP/setting.json /storage/emulated/0/
  32. fi
  33. adb uninstall com.kyen.imagedetection
  34. adb install -r $(pwd)/$SIGNED_OUT_APK
  35. adb shell am start -n com.kyen.imagedetection/com.picturegrabbingsystem.MainActivity
  36. #adb logcat --pid=`adb shell ps | grep com.kyen.imagedetection | awk '{print $2}'` -v color -v threadtime
  37. local RELEASE_A
  38. read -p "would you like to package a release pack?<y/n>: " RELEASE_A
  39. echo "your choice [ " $RELEASE_A " ]"
  40. if [ $RELEASE_A == y ];then
  41. local RELEASE_VERSION
  42. read -p "must input version info: " RELEASE_VERSION
  43. echo "version for [ " $RELEASE_VERSION " ]"
  44. ./release.sh $SIGNED_OUT_APK_NAME $RELEASE_VERSION
  45. fi
  46. else
  47. echo "signed failed"
  48. fi