You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -16,10 +16,13 @@ In some cases, you’ll need to tweak the configuration files that FlutterFlow g
16
16
Here are the key configuration files you can edit:
17
17
18
18
-[**`AndroidManifest.xml`**](#androidmanifestxml-android) – Configures app permissions, metadata, and intent filters for Android.
19
+
-[**`build.gradle`**](#buildgradle-android) – Defines Android specific build configurations such as compile SDK version, dependencies, build types, and signing configurations.
20
+
-[**ProGuard files**](#proguard-file-android) – Used for code shrinking and obfuscation in Android builds.
19
21
-[**`Info.plist`**](#infoplist-ios)– Manages iOS app settings, including permissions and configurations.
20
22
-[**`Entitlements.plist`**](#entitlementsplist-ios) – Defines iOS app privileges such as push notifications and Apple Pay.
23
+
-[**`AppDelegate.swift`**](#appdelegateswift-ios) – Manages iOS app launch behavior and runtime configuration. It registers Flutter plugins, initializes services like Firebase, and handles app lifecycle events and deep linking.
21
24
-[**`main.dart`**](#maindart-flutter) – The entry point of your Flutter app, where you can modify app-level logic.
22
-
-[**ProGuard files**](#proguard-file-android) – Used for code shrinking and obfuscation in Android builds.
25
+
23
26
24
27
:::warning
25
28
@@ -29,17 +32,17 @@ In short, edit native code only when necessary, and do so carefully.
29
32
30
33
:::
31
34
32
-
## Editing native XML Files (AndroidManifest.xml, Info.plist, Entitlements.plist)
35
+
## Editing Files
33
36
34
-
FlutterFlow provides two main ways to modify native XML files: [**Add Individual Snippets**](#option-1-add-individual-snippets) and [**Manual Edit Mode**](#option-2-manual-edit-mode).
37
+
FlutterFlow provides two main ways to modify native files: [**Add Individual Snippets**](#option-1-add-individual-snippets) and [**Manual Edit Mode**](#option-2-manual-edit-mode).
35
38
36
39
### Option 1: Add Individual Snippets
37
40
38
41
**Snippets** are small pieces of code that you can inject into the native files at predefined locations. Instead of opening the whole file to edit, you provide just the fragment you want to add, and FlutterFlow merges it into the file in the correct place. This is safer and easier for small additions such as a permission line or a meta-data tag.
39
42
40
43
#### Snippet Placement for Android
41
44
42
-
For Android, modifications are typically made in the `AndroidManifest.xml` file, where you can add the following tags:
45
+
Let’s see how to add a snippet for the `AndroidManifest.xml` file, where you can add the following tags:
43
46
44
47
-**Activity Tags:** Inserts XML code inside the `MainActivity` block. This is typically used to add child XML elements within the MainActivity, such as `<intent-filter>` or `<meta-data>` to control aspects such as deep linking, theme application, or launch mode.
45
48
-**Application Tags**: Used to inject properties or attributes directly on the `<application>` tag itself. For example, you can use this to set values such as `android:icon`, `android:label`, `android:allowBackup`.
@@ -75,9 +78,9 @@ To add a snippet to your `AndroidManifest.xml`, navigate to **Custom Code** from
75
78
76
79
#### Snippet Placement for iOS
77
80
78
-
For iOS, you can modify the `Info.plist` and `Entitlements.plist` files. There’s no nested application/activity structure like on Android. Instead, both files are dictionaries of key-value pairs. When you add a snippet, it’s placed directly under the root `<dict>` element of these plist files.
81
+
For iOS, let’s see how to add a snippet for the `Info.plist` and `Entitlements.plist` files. There’s no nested application/activity structure like on Android. Instead, both files are dictionaries of key-value pairs. When you add a snippet, it’s placed directly under the root `<dict>` element of these plist files.
79
82
80
-
To add a snippet to native iOS files, navigate to **Custom Code** (from the left-side menu) > **Configuration Files**, and select the desired file (`Info.plist` or `Entitlements.plist`). Click the **plus** (+) button, provide a descriptive name (which will appear as a comment in the file), and paste your snippet code.
83
+
To add a snippet to native iOS files, navigate to **Custom Code** (from the left-side menu) > **Configuration Files**, and select the desired file. Click the **plus** (+) button, provide a descriptive name (which will appear as a comment in the file), and paste your snippet code.
81
84
82
85
<div style={{
83
86
position: 'relative',
@@ -396,6 +399,161 @@ If your app needs to communicate over HTTP (unencrypted) for testing or legacy r
396
399
You can modify the `AndroidManifest.xml` file by either [**adding a snippet**](#snippet-placement-for-android) or [**editing it manually**](#option-2-manual-edit-mode).
397
400
:::
398
401
402
+
### `build.gradle` (Android)
403
+
404
+
The `build.gradle` file is the main Gradle build script for your Android app module. It resides in the `android/app/` directory and controls how your Android app is compiled, packaged, and built. This file defines critical configuration such as:
Use this to reduce APK size and protect code in production.
467
+
468
+
**Example 4: Enabling MultiDex for Large Apps**
469
+
470
+
If your app exceeds the 64K method limit (common when using many dependencies), enable MultiDex support:
471
+
472
+
```jsx
473
+
defaultConfig {
474
+
...
475
+
multiDexEnabled true
476
+
}
477
+
```
478
+
479
+
Use this when your build fails with `Too many methods` errors or when integrating large libraries like Firebase.
480
+
481
+
:::tip
482
+
You can modify the `build.gradle` file by either [**adding a snippet**](#snippet-placement-for-ios) or [**editing it manually**](#option-2-manual-edit-mode).
483
+
:::
484
+
485
+
### ProGuard File (Android)
486
+
487
+
The **ProGuard file (`proguard-rules.pro`)** is a configuration file used in Android projects to optimize, shrink, and obfuscate the app’s code. It helps reduce APK or AAB size, improves performance, and protects the app’s code from reverse engineering by making it difficult to decompile.
488
+
489
+
The ProGuard files allow you to specify rules to keep certain classes or methods (prevent them from being removed or renamed), or to tweak the obfuscation behavior. Located in the **`android/app/proguard-rules.pro`** directory of an Android project, the ProGuard rules are applied when code shrinking is enabled in a release build.
490
+
491
+
Here are some scenarios where you may need to modify the ProGuard file:
492
+
493
+
**Example 1: Preventing Issues with Third-Party Libraries**
494
+
495
+
ProGuard can obfuscate critical libraries, breaking their functionality. To prevent this, you need to keep specific classes used by the library.
496
+
497
+
```jsx
498
+
# Firebase
499
+
-keep classcom.google.firebase.** { *; }
500
+
501
+
# Gson (JSON Serialization)
502
+
-keep classcom.google.gson.** { *; }
503
+
-keepattributes *Annotation*
504
+
```
505
+
506
+
This ensures that Firebase and Gson classes are not obfuscated, preventing serialization errors.
507
+
508
+
**Example 2: Debugging ProGuard Issues**
509
+
510
+
If your app crashes in release mode but works in debug mode, ProGuard might be removing important classes. To troubleshoot, you can add logging and keep rules.
511
+
512
+
```jsx
513
+
-assumenosideeffects classandroid.util.Log {
514
+
publicstatic***d(...);
515
+
publicstatic***v(...);
516
+
publicstatic***i(...);
517
+
}
518
+
```
519
+
520
+
This removes debug logs in release builds but retains them for troubleshooting.
521
+
522
+
**Example 3: Improving Security by Removing Debug Information**
523
+
524
+
Attackers can decompile APKs and view sensitive debug logs. To remove these debug logs, add:
This ensures reflection-based code continues working.
556
+
399
557
### `Info.plist` (iOS)
400
558
401
559
`Info.plist` (Information Property List) is the configuration file for iOS apps. It’s a structured XML file that provides iOS with essential information about your app’s configuration and requirements.
@@ -535,6 +693,34 @@ This enables your app to create, manage, and present passes in Apple Wallet.
535
693
You can modify the `Entitlements.plist` file by either [**adding a snippet**](#snippet-placement-for-ios) or [**editing it manually**](#option-2-manual-edit-mode).
536
694
:::
537
695
696
+
### `AppDelegate.swift` (iOS)
697
+
698
+
The `AppDelegate.swift` file is the entry point for your iOS application. It plays a crucial role in setting up your app’s runtime environment and handling app lifecycle events such as launching, backgrounding, and termination. This file is also where you register Flutter plugins and initialize SDKs like Firebase or Branch.
699
+
700
+
It’s located at: `ios/Runner/AppDelegate.swift`
701
+
702
+
**Example: Registering Custom iOS Plugins**
703
+
704
+
For custom native iOS plugins that aren’t auto-registered, you can manually register them inside `AppDelegate.swift`.
Use this for custom iOS integrations that require manual setup.
719
+
720
+
:::tip
721
+
You can modify the `AppDelegate.swift` file by either [**adding a snippet**](#snippet-placement-for-ios) or [**editing it manually**](#option-2-manual-edit-mode).
722
+
:::
723
+
538
724
### `main.dart` (Flutter)
539
725
540
726
The `main.dart` file is the entry point of every FlutterFlow app. It is the first file that runs when the app starts and is responsible for initializing the application, configuring dependencies, and defining the root widget. Located in the **`lib/`** directory, `main.dart` contains the `main()` function, which is required for every FlutterFlow app.
@@ -642,77 +828,6 @@ class AppLifecycleObserver with WidgetsBindingObserver {
642
828
}
643
829
```
644
830
645
-
### ProGuard File (Android)
646
-
647
-
The **ProGuard file (`proguard-rules.pro`)** is a configuration file used in Android projects to optimize, shrink, and obfuscate the app’s code. It helps reduce APK or AAB size, improves performance, and protects the app’s code from reverse engineering by making it difficult to decompile.
648
-
649
-
The ProGuard files allow you to specify rules to keep certain classes or methods (prevent them from being removed or renamed), or to tweak the obfuscation behavior. Located in the **`android/app/proguard-rules.pro`** directory of an Android project, the ProGuard rules are applied when code shrinking is enabled in a release build.
650
-
651
-
Here are some scenarios where you may need to modify the ProGuard file:
652
-
653
-
**Example 1: Preventing Issues with Third-Party Libraries**
654
-
655
-
ProGuard can obfuscate critical libraries, breaking their functionality. To prevent this, you need to keep specific classes used by the library.
656
-
657
-
```jsx
658
-
# Firebase
659
-
-keep classcom.google.firebase.** { *; }
660
-
661
-
# Gson (JSON Serialization)
662
-
-keep classcom.google.gson.** { *; }
663
-
-keepattributes *Annotation*
664
-
```
665
-
666
-
This ensures that Firebase and Gson classes are not obfuscated, preventing serialization errors.
667
-
668
-
**Example 2: Debugging ProGuard Issues**
669
-
670
-
If your app crashes in release mode but works in debug mode, ProGuard might be removing important classes. To troubleshoot, you can add logging and keep rules.
671
-
672
-
```jsx
673
-
-assumenosideeffects classandroid.util.Log {
674
-
publicstatic***d(...);
675
-
publicstatic***v(...);
676
-
publicstatic***i(...);
677
-
}
678
-
```
679
-
680
-
This removes debug logs in release builds but retains them for troubleshooting.
681
-
682
-
**Example 3: Improving Security by Removing Debug Information**
683
-
684
-
Attackers can decompile APKs and view sensitive debug logs. To remove these debug logs, add:
0 commit comments