Flutter Failed to build appbundle when using DeferredComponent

197 views Asked by At

I'm using DeferredComponent in my Flutter project. The app run successfully in debug and release mode. However, when I try to make an appbundle, the Deferred Components validation fails with the following error.

ERROR LOG

=================================================================================
                     Deferred components prebuild validation
=================================================================================
Modified android files:
  - salt_coding_challenge\build\android_deferred_components_setup_files\app\src\main\res\values\strings.xml

The above files have been placed into `build/android_deferred_components_setup_files`,
a temporary directory. The files should be reviewed and moved into the project's
`android` directory.
---------------------------------------------------------------------------------

Setup verification can be skipped by passing the `--no-validate-deferred-components`
flag, however, doing so may put your app at risk of not functioning even if the
build is successful.
=================================================================================
Setup for deferred components incomplete. See recommended actions.
PS C:\Data\StudioProjects\salt_coding_challenge> flutter build appbundle -v
[  +18 ms] executing: [C:\src\flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[  +62 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[   +1 ms] 9944297138845a94256f1cf37beb88ff9a8e811a
[        ] executing: [C:\src\flutter/] git tag --points-at 9944297138845a94256f1cf37beb88ff9a8e811a
[  +72 ms] Exit code 0 from: git tag --points-at 9944297138845a94256f1cf37beb88ff9a8e811a
[        ] 3.7.3
[  +16 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref --symbolic @{upstream}
[  +44 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{upstream}
[        ] origin/stable
[        ] executing: [C:\src\flutter/] git ls-remote --get-url origin
[  +52 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[  +63 ms] executing: [C:\src\flutter/] git rev-parse --abbrev-ref HEAD
[  +49 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] stable
[  +46 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[   +4 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +35 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[   +1 ms] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[  +96 ms] Skipping pub get: version match.
[  +87 ms] Found plugin webview_flutter at C:\Users\Rajabi\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter-3.0.4\
[   +4 ms] Found plugin webview_flutter_android at C:\Users\Rajabi\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter_android-2.10.4\
[   +2 ms] Found plugin webview_flutter_wkwebview at C:\Users\Rajabi\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter_wkwebview-2.9.5\
[  +61 ms] Found plugin webview_flutter at C:\Users\Rajabi\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter-3.0.4\
[   +1 ms] Found plugin webview_flutter_android at C:\Users\Rajabi\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter_android-2.10.4\
[   +1 ms] Found plugin webview_flutter_wkwebview at C:\Users\Rajabi\AppData\Local\Pub\Cache\hosted\pub.dev\webview_flutter_wkwebview-2.9.5\
[   +7 ms] Generating C:\Data\StudioProjects\salt_coding_challenge\android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java
[  +91 ms] =================================================================================
[   +1 ms]                      Deferred components prebuild validation
[        ] =================================================================================
[        ] Modified android files:
[        ]   - salt_coding_challenge\build\android_deferred_components_setup_files\app\src\main\res\values\strings.xml
[        ] The above files have been placed into `build/android_deferred_components_setup_files`,
           a temporary directory. The files should be reviewed and moved into the project's
           `android` directory.
[        ] ---------------------------------------------------------------------------------

[        ] Setup verification can be skipped by passing the `--no-validate-deferred-components`
           flag, however, doing so may put your app at risk of not functioning even if the
           build is successful.
           =================================================================================
[   +8 ms] "flutter appbundle" took 507ms.
[   +3 ms] Setup for deferred components incomplete. See recommended actions.
[   +2 ms]
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      DeferredComponentsValidator.attemptToolExit (package:flutter_tools/src/android/deferred_components_validator.dart:220:7)
           #2      DeferredComponentsValidator.handleResults (package:flutter_tools/src/android/deferred_components_validator.dart:102:5)
           #3      BuildAppBundleCommand.runCommand (package:flutter_tools/src/commands/build_appbundle.dart:132:17)
           <asynchronous suspension>
           #4      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1257:27)
           <asynchronous suspension>
           #5      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #6      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:283:9)
           <asynchronous suspension>
           #8      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
           <asynchronous suspension>
           #10     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:64:9)
           <asynchronous suspension>
           #11     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #12     main (package:flutter_tools/executable.dart:91:3)
           <asynchronous suspension>


[ +264 ms] ensureAnalyticsSent: 263ms
[        ] Running 0 shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1

What's causing this error? And how to prevent it?

Modified android files:
  - salt_coding_challenge\build\android_deferred_components_setup_files\app\src\main\res\values\strings.xml

The above files have been placed into `build/android_deferred_components_setup_files`,
a temporary directory. The files should be reviewed and moved into the project's
`android` directory

Am I missing something when setting up my deferred component?

1

There are 1 answers

0
Naufal Rajabi On BEST ANSWER

I finally found the answer. Basically, this error

Modified android files:
  - salt_coding_challenge\build\android_deferred_components_setup_files\app\src\main\res\values\strings.xml

The above files have been placed into `build/android_deferred_components_setup_files`,
a temporary directory. The files should be reviewed and moved into the project's
`android` directory

indicates there is an error within the moved files. In my case the moved file is string.xml. In my case, I called the string resources in the AndroidManifest.xml. I called @string/defComponent meanwhile the resources named defComponentName in strings.xml.