Skip to content

Commit

Permalink
APK build script
Browse files Browse the repository at this point in the history
  • Loading branch information
duogenesis committed Mar 24, 2024
1 parent 96d6e5f commit cbdf4a3
Show file tree
Hide file tree
Showing 49 changed files with 578 additions and 35 deletions.
6 changes: 5 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,11 @@ const KeyboardFixingContainer = ({children}) => {
if (Platform.OS === 'web') {
return <>{children}</>;
} else {
return <View style={{ height, width }}>{children}</View>
return (
<View style={{ height: height + (StatusBar.currentHeight ?? 0), width }}>
{children}
</View>
)
}
};

Expand Down
37 changes: 4 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,40 +37,11 @@ DUOLICIOUS_UPLOAD_KEY_PASSWORD=*****
Then:

```bash
export DUO_STATUS_URL=https://status.duolicious.app
export DUO_API_URL=https://api.duolicious.app
export DUO_CHAT_URL=wss://chat.duolicious.app
export DUO_IMAGES_URL=https://user-images.duolicious.app

rm -rf android ios

# To generate all the Android and IOS files
EXPO_NO_GIT_STATUS=1 npx expo prebuild --clean

# Maybe do this, maybe don't. See below.
git clean -f android/app/src/main/res/
git checkout android/app/src/main/res/ android/app/src/main/ic_launcher-playstore.png
git apply git-patches/build.gradle.patch

# Some random person on GitHub recommended this and I don't know why it's needed
( cd android && ./gradlew clean )

# TODO: change minSdkVersion in android/build.gradle to 27

( cd android && ./gradlew build )

adb install android/app/build/outputs/apk/release/app-release.apk

# Make sure to connect your device or to run your Emulator
npx react-native run-android --mode=release

# If you want to sign the APK and publish to Google Play Store.
npx react-native build-android --mode=release
./build-apk.sh
```

At some point (I think before running `run-android` or `build-android`), I opened the `android/` directory in Android Studio. Then I navigated to `android/app/src/main/res/` in the file tree. I right-clicked the directory and clicked 'New' > 'Image Asset'. Then I followed the wizard, using `assets/icon.png` as my icon, zoomed in at 67%. If you don't do all that, the Android app will have a white border around it. I don't understand why. But now that I've done that, it's possible to run this instead:
If you want to install the APK:

```bash
git clean -f android/app/src/main/res/
git checkout android/app/src/main/res/ android/app/src/main/ic_launcher-playstore.png
```
adb install android/app/build/outputs/apk/release/app-release.apk
```
File renamed without changes.
11 changes: 11 additions & 0 deletions apk-build-resources/build.gradle.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- android/build.gradle 2024-03-22 20:00:55.657578943 +1100
+++ android/build.gradle.b 2024-03-22 20:01:09.837799023 +1100
@@ -3,7 +3,7 @@
buildscript {
ext {
buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
- minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '23')
+ minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '27')
compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '34')
targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
kotlinVersion = findProperty('android.kotlinVersion') ?: '1.8.10'
Binary file added apk-build-resources/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
148 changes: 148 additions & 0 deletions apk-build-resources/res/drawable-anydpi/ic_action_name.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="4.2333"
android:viewportHeight="4.2333"
android:tint="#333333"
android:alpha="0.6">
<path
android:pathData="M2.3812,1.0583h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.6458,1.0583h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.1167,1.3229h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.1167,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.3812,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.6458,2.1167h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.9104,2.3812h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.175,2.1167h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.4396,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.7042,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.7042,1.3229h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.9104,1.3229h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.175,1.0583h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.4396,1.0583h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.5292,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.7938,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.2646,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.2646,2.1167h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.5292,2.3812h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.7938,2.6458h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.0583,2.9104h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.3229,2.6458h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.5875,2.3812h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.8521,2.1167h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.8521,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.0583,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.3229,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.5875,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
</vector>
152 changes: 152 additions & 0 deletions apk-build-resources/res/drawable-anydpi/ic_stat_name.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="4.2333"
android:viewportHeight="4.2333"
android:tint="#FFFFFF">
<group android:scaleX="0.92"
android:scaleY="0.92"
android:translateX="0.169332"
android:translateY="0.169332">
<path
android:pathData="M2.3812,1.0583h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.6458,1.0583h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.1167,1.3229h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.1167,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.3812,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.6458,2.1167h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.9104,2.3812h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.175,2.1167h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.4396,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.7042,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.7042,1.3229h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.9104,1.3229h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.175,1.0583h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M3.4396,1.0583h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.5292,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.7938,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.2646,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.2646,2.1167h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.5292,2.3812h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M0.7938,2.6458h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.0583,2.9104h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.3229,2.6458h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.5875,2.3812h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.8521,2.1167h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.8521,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.0583,1.8521h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.3229,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
<path
android:pathData="M1.5875,1.5875h0.2646v0.2646h-0.2646z"
android:strokeWidth="1"
android:fillColor="#ffffff"
android:strokeLineCap="round"/>
</group>
</vector>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cbdf4a3

Please sign in to comment.