-
-
Notifications
You must be signed in to change notification settings - Fork 239
Expand file tree
/
Copy pathbuild-aab.sh
More file actions
41 lines (33 loc) · 1.23 KB
/
build-aab.sh
File metadata and controls
41 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
function err_and_exit()
{
echo "$1" >&2
exit 1
}
function getVersionName()
{
echo $(grep versionName ./app/build.gradle.kts | awk -F '"' '{print $2}')
}
sed -i -e '/READ_SMS/d' ./app/src/main/AndroidManifest.xml
sed -i -e '/SEND_SMS/d' ./app/src/main/AndroidManifest.xml
sed -i -e '/READ_CALL_LOG/d' ./app/src/main/AndroidManifest.xml
sed -i -e '/WRITE_CALL_LOG/d' ./app/src/main/AndroidManifest.xml
sed -i -e '/REQUEST_INSTALL_PACKAGES/d' ./app/src/main/AndroidManifest.xml
sed -i -e '/QUERY_ALL_PACKAGES/d' ./app/src/main/AndroidManifest.xml
sed -i -e '/REQUEST_DELETE_PACKAGES/d' ./app/src/main/AndroidManifest.xml
perl -i -0pe 's/\n\s+<service\n[^<]*\.services\.PlainAccessibilityService[\s\S]*?<\/service>//g' ./app/src/main/AndroidManifest.xml
cat > ./keystore.properties <<EOF
storePassword=$ANDROID_STORE_PASSWORD
keyPassword=$ANDROID_KEY_PASSWORD
keyAlias=release
storeFile=release.jks
EOF
cat > ./local.properties <<EOF
sdk.dir=/Users/$USER/Library/Android/sdk
EOF
cat > ./app/play-config.json <<EOF
$PLAY_STORE_CONFIG_JSON
EOF
./gradlew :app:bundleRelease || err_and_exit "build failed"
BUILD_FILE="PlainApp-$(getVersionName)-Google-Play.aab"
mv ./app/build/outputs/bundle/googleRelease/app-google-release.aab $BUILD_FILE