Fix android app configuration and refactor keystore generation and update docs on building
parent
21446a3de0
commit
c9202b73ad
@ -1,64 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! test -f ./android/app/upload-keystore.jks
|
||||
then
|
||||
if test -f ./android/key.properties; then rm ./android/key.properties; fi
|
||||
|
||||
echo "**No keystore found, so we'll need to generate one.**"
|
||||
echo ""
|
||||
|
||||
echo "Please enter a password for the keystore (a least 6 characters):"
|
||||
|
||||
stty_orig=$(stty -g)
|
||||
stty -echo
|
||||
read ANDROID_KEY_STORE_PWD
|
||||
stty $stty_orig
|
||||
|
||||
echo "Now please enter a password for the certificate key (at least 6 characters):"
|
||||
|
||||
stty_orig=$(stty -g)
|
||||
stty -echo
|
||||
read ANDROID_KEY_PWD
|
||||
stty $stty_orig
|
||||
|
||||
echo "Generating keystore... please follow the prompts"
|
||||
echo ""
|
||||
keytool -genkey -v -keystore ./android/app/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload -storepass $ANDROID_KEY_STORE_PWD -keypass $ANDROID_KEY_PWD
|
||||
fi
|
||||
|
||||
|
||||
if ! test -f ./android/key.properties
|
||||
then
|
||||
if test -z "${ANDROID_KEY_STORE_PWD}"
|
||||
then
|
||||
echo "Please enter keystore password:"
|
||||
|
||||
stty_orig=$(stty -g)
|
||||
stty -echo
|
||||
read ANDROID_KEY_STORE_PWD
|
||||
stty $stty_orig
|
||||
fi
|
||||
|
||||
if test -z "${ANDROID_KEY_PWD}"
|
||||
then
|
||||
echo "Please enter certificate key password:"
|
||||
|
||||
stty_orig=$(stty -g)
|
||||
stty -echo
|
||||
read ANDROID_KEY_PWD
|
||||
stty $stty_orig
|
||||
fi
|
||||
|
||||
ANDROID_KEY_STORE_PWD=$ANDROID_KEY_STORE_PWD ANDROID_KEY_PWD=$ANDROID_KEY_PWD ./scripts/setenv.sh || exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Now executing [flutter build apk]..."
|
||||
|
||||
flutter build apk
|
||||
|
||||
## Uncomment the below command if you wish for the file containing the passwords to be deleted post-build
|
||||
## (requires re-entering keystore passwords when this script is run again)
|
||||
#rm ./android/key.properties
|
||||
|
||||
exit 0
|
@ -1,7 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.jointwtxt.goryon">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="social.yarn.goryon">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
|
@ -1,48 +1,30 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.jointwtxt.goryon">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.jointwtxt.goryon">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
|
||||
calls FlutterMain.startInitialization(this); in its onCreate method.
|
||||
In most cases you can leave this as-is, but you if you want to provide
|
||||
additional functionality it is fine to subclass or reimplement
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="Goryon"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
<activity
|
||||
android:name="com.jointwtxt.goryon.MainActivity"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<application android:name="io.flutter.app.FlutterApplication" android:label="Goryon" android:icon="@mipmap/ic_launcher">
|
||||
<activity android:name="social.yarn.goryon.MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
/>
|
||||
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme" />
|
||||
<!-- Displays an Android View that continues showing the launch screen
|
||||
Drawable until Flutter paints its first frame, then this splash
|
||||
screen fades out. A splash screen is useful to avoid any visual
|
||||
gap between the end of Android's launch screen and the painting of
|
||||
Flutter's first frame. -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.SplashScreenDrawable"
|
||||
android:resource="@drawable/launch_background"
|
||||
/>
|
||||
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable" android:resource="@drawable/launch_background" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
<meta-data android:name="flutterEmbedding" android:value="2" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.jointwtxt.goryon">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="social.yarn.goryon">
|
||||
<!-- Flutter needs it to communicate with the running application
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
|
@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
random_string() {
|
||||
n="${1:-32}"
|
||||
tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w "$n" | head -n 1
|
||||
}
|
||||
|
||||
if ! [ -f ./android/app/upload-keystore.jks ]; then
|
||||
[ -f ./android/key.properties ] && rm ./android/key.properties
|
||||
|
||||
echo "No keystore found, generating a new one..."
|
||||
echo
|
||||
|
||||
ANDROID_KEY_STORE_PWD="$(random_string 12)"
|
||||
ANDROID_KEY_PWD="$(random_string 12)"
|
||||
|
||||
echo "Generating keystore... "
|
||||
echo
|
||||
|
||||
keytool -v -alias upload -genkey -keyalg RSA -keysize 2048 -validity 10000 \
|
||||
-keypass "$ANDROID_KEY_PWD" -storepass "$ANDROID_KEY_STORE_PWD" \
|
||||
-keystore ./android/app/upload-keystore.jks
|
||||
|
||||
echo "Generating .envrc ..."
|
||||
echo
|
||||
|
||||
{
|
||||
printf "export ANDROID_KEY_STORE_PWD=%s\n" "$ANDROID_KEY_STORE_PWD"
|
||||
printf "export ANDROID_KEY_PWD=%s\n" "$ANDROID_KEY_PWD"
|
||||
} > .envrc
|
||||
|
||||
echo "Settings up key.properties ..."
|
||||
echo
|
||||
(
|
||||
export ANDROID_KEY_STORE_PWD ANDROID_KEY_PWD
|
||||
./scripts/set-key-properties.sh
|
||||
) || exit 1
|
||||
fi
|
@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "${ANDROID_KEY_STORE_PWD}" ]; then
|
||||
echo "ANDROID_KEY_STORE_PWD not found, abort"
|
||||
exit 1
|
||||
else
|
||||
echo "ANDROID_KEY_STORE_PWD detected, proceeding..."
|
||||
fi
|
||||
|
||||
if [ -z "${ANDROID_KEY_PWD}" ]; then
|
||||
echo "ANDROID_KEY_PWD not found, abort"
|
||||
exit 1
|
||||
else
|
||||
echo "ANDROID_KEY_PWD detected, proceeding..."
|
||||
fi
|
||||
|
||||
{
|
||||
echo "storePassword=${ANDROID_KEY_STORE_PWD}"
|
||||
echo "keyPassword=${ANDROID_KEY_PWD}"
|
||||
echo "keyAlias=upload"
|
||||
echo "storeFile=upload-keystore.jks"
|
||||
} >> android/key.properties
|
@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "${ANDROID_KEY_STORE_PWD}" ]; then
|
||||
echo "ANDROID_KEY_STORE_PWD not found, abort"
|
||||
exit 1
|
||||
else
|
||||
echo "ANDROID_KEY_STORE_PWD detected, proceeding..."
|
||||
fi
|
||||
|
||||
if [ -z "${ANDROID_KEY_PWD}" ]; then
|
||||
echo "ANDROID_KEY_PWD not found, abort"
|
||||
exit 1
|
||||
else
|
||||
echo "ANDROID_KEY_PWD detected, proceeding..."
|
||||
fi
|
||||
|
||||
{
|
||||
echo "storePassword=${ANDROID_KEY_STORE_PWD}"
|
||||
echo "keyPassword=${ANDROID_KEY_PWD}"
|
||||
echo "keyAlias=upload"
|
||||
echo "storeFile=upload-keystore.jks"
|
||||
} >> android/key.properties
|
||||
|
||||
## Below has been commented out by eldersnake@yarn.andrewjvpowell.com
|
||||
## as we're generating the keystore in the android-build-wrapper.sh script
|
||||
## Uncomment out the below if running this script on its own (and if you know how to set the below variables!)
|
||||
|
||||
#echo "${RELEASE_KEYSTORE}" > release.keystore.asc
|
||||
#gpg -d --passphrase "${RELEASE_KEYSTORE_PASSPHRASE}" --batch release.keystore.asc > android/app/key.jks
|
||||
|
||||
#mkdir -p keys/android
|
||||
#echo "${RELEASE_SERVICE_ACCOUNT_KEYSTORE}" > service_account.keystore.asc
|
||||
#gpg -d --passphrase "${RELEASE_KEYSTORE_PASSPHRASE}" --batch service_account.keystore.asc > keys/android/service_account.json
|
Loading…
Reference in New Issue