Skip to content

Commit

Permalink
Android refresh (#239)
Browse files Browse the repository at this point in the history
* ⬆️ Upgrade intl package (Flutter 3.22)

* 🚚 Recreate Android folder & migrate core changes

* 🔥 Reinitialize Firebase

* 🔧 Add signing config

* 🔖 Release pre 2.12.4-pre.1+148

* 👷 Use Java 17. And update outdated ci steps
  • Loading branch information
iqfareez authored Jun 3, 2024
1 parent 2ea39ad commit fb50c3c
Show file tree
Hide file tree
Showing 26 changed files with 198 additions and 130 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_aab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "11"
java-version: "17"

- name: Setup Flutter stable
uses: subosito/flutter-action@v2
Expand All @@ -41,7 +41,7 @@ jobs:
run: flutter build appbundle

- name: Upload aab
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: build/app/outputs/bundle/release/*.aab

Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3.9.0
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "11"
java-version: "17"

- name: Setup Flutter
uses: subosito/flutter-action@v2.8.0
uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version-file: pubspec.yaml # path to pubspec.yaml

# File can be encoded to base64 on https://base64.guru/converter/encode/file
- name: Decoding android/key.properties
Expand All @@ -34,7 +35,7 @@ jobs:
run: flutter build appbundle

- name: Upload aab
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: "!github.event.release.prerelease"
with:
name: aab-release
Expand All @@ -55,7 +56,7 @@ jobs:
echo ":white_check_mark: Build split apk" >> $GITHUB_STEP_SUMMARY
- name: Upload apks
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: apk-releases
path: build/app/outputs/apk/release/*.apk
Expand All @@ -69,18 +70,18 @@ jobs:
needs: build_android
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: apk-releases

- name: Rename apk
run: curl -s https://gist.githubusercontent.com/iqfareez/f57405016cc8bcc51cdcd2879c88807a/raw/5d9bbed7231a9e56bf24b88ab5286cee73dae173/rename_apk.sh | bash -s MPT .

- name: Upload file to the assets release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: "*.apk"

Expand All @@ -94,7 +95,7 @@ jobs:
needs: build_android
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: aab-release

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/build_apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "11"
java-version: "17"

- name: Setup Flutter
uses: subosito/flutter-action@v2
Expand All @@ -48,25 +48,25 @@ jobs:
flutter build apk --split-per-abi --release -v
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: splitted apk artifacts
path: build/app/outputs/apk/release/*.apk

- name: Upload artifacts (arm64-v8a)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: arm64-v8a artifact
path: build/app/outputs/apk/release/*-arm64-v8a-release.apk

- name: Upload artifacts (armeabi-v7a)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: armeabi-v7a artifact
path: build/app/outputs/apk/release/*-armeabi-v7a-release.apk

- name: Upload artifacts (x86_64)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: x86_64 artifact
path: build/app/outputs/apk/release/*-x86_64-release.apk
Expand All @@ -80,7 +80,7 @@ jobs:
flutter build apk --release
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: fat apk artifact
path: build/app/outputs/apk/release/*.apk
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ app.*.map.json
*.apk
*.aab

# key file
key.properties
android/key.jks

# scratch file
scratch.dart
untranslated.txt
24 changes: 22 additions & 2 deletions .metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,27 @@
# This file should be version controlled and should not be manually edited.

version:
revision: 5f21edf8b66e31a39133177319414395cc5b5f48
channel: stable
revision: "5dcb86f68f239346676ceb1ed1ea385bd215fba1"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
- platform: android
create_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1
base_revision: 5dcb86f68f239346676ceb1ed1ea385bd215fba1

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
6 changes: 6 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ gradle-wrapper.jar
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
key.properties
**/*.keystore
**/*.jks
59 changes: 26 additions & 33 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
plugins {
id "com.android.application"
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
// END: FlutterFire Configuration
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
if (flutterVersionCode == null) {
flutterVersionCode = '1'
flutterVersionCode = "1"
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
def flutterVersionName = localProperties.getProperty("flutter.versionName")
if (flutterVersionName == null) {
flutterVersionName = '1.0'
flutterVersionName = "1.0"
}

def keystoreProperties = new Properties()
Expand All @@ -36,28 +34,26 @@ if (keystorePropertiesFile.exists()) {
}

android {
compileSdkVersion 34

lintOptions {
disable 'InvalidPackage'
}
namespace = "live.iqfareez.waktusolatmalaysia"
compileSdk = 34
ndkVersion = flutter.ndkVersion

compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId "live.iqfareez.waktusolatmalaysia"
minSdkVersion 21
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
//TODO: Remove multidex when app support min 21 or higher
applicationId = "live.iqfareez.waktusolatmalaysia"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 21
targetSdk = 34
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
}

signingConfigs {
Expand All @@ -71,16 +67,13 @@ android {

buildTypes {
release {
signingConfig signingConfigs.release
signingConfig = signingConfigs.release
}
}
buildFeatures {
viewBinding true
}
}

flutter {
source '../..'
source = "../.."
}

dependencies {
Expand All @@ -91,4 +84,4 @@ dependencies {
implementation 'androidx.window:window-java:1.0.0'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.google.android.material:material:1.7.0'
}
}
6 changes: 3 additions & 3 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="live.iqfareez.waktusolatmalaysia">
<!-- Flutter needs it to communicate with the running application
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
36 changes: 20 additions & 16 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="live.iqfareez.waktusolatmalaysia">
<!-- 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. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand Down Expand Up @@ -47,22 +40,23 @@
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
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" />

android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<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> <!-- Notification receiver -->
</activity>
<!-- Notification receiver -->
<receiver
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
android:exported="false" />
Expand All @@ -86,5 +80,15 @@
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
</manifest>
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>

This file was deleted.

Loading

0 comments on commit fb50c3c

Please sign in to comment.