Build issue in Task :capacitor-cordova-android-plugins:processDebugManifest FAILED

> Task :capacitor-cordova-android-plugins:processDebugManifest FAILED
/builds/Ahmed-Galal/moodleapp/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml:47:60-92 Error:
	Attribute uses-feature#android.hardware.location.gps@required at AndroidManifest.xml:47:60-92 has an illegal value=($GPS_REQUIRED), expected 'true' or 'false'
/builds/Ahmed-Galal/moodleapp/android/capacitor-cordova-android-plugins/src/main/AndroidManifest.xml Error:
	Validation failed, exiting

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':capacitor-cordova-android-plugins:processDebugManifest'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Manifest merger failed with multiple errors, see logs

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 43s
15 actionable tasks: 15 executed
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane_core/lib/fastlane_core/ui/ui.rb:17:in `method_missing'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/helper/sh_helper.rb:80:in `sh_control_output'
	from /usr/local/lib/ruby/2.6.0/forwardable.rb:230:in `sh'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/helper/gradle_helper.rb:32:in `trigger'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/actions/gradle.rb:60:in `run'
	from /builds/Ahmed-Galal/moodleapp/fastlane/actions/build_android_capacitor.rb:58:in `run'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/runner.rb:261:in `block (2 levels) in execute_action'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/runner.rb:253:in `block in execute_action'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/runner.rb:227:in `chdir'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/runner.rb:227:in `execute_action'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
	from Fastfile:144:in `block (2 levels) in parsing_binding'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/lane.rb:33:in `call'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/runner.rb:45:in `chdir'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/runner.rb:45:in `execute'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/lane_manager.rb:47:in `cruise_lane'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
	from /usr/local/bundle/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
	from /usr/local/bundle/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
	from /usr/local/bundle/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
	from /usr/local/bundle/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/commands_generator.rb:352:in `run'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
	from /usr/local/bundle/gems/fastlane-2.148.1/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
	from /usr/local/bundle/gems/fastlane-2.148.1/bin/fastlane:23:in `<top (required)>'
	from /usr/local/bundle/bin/fastlane:23:in `load'
	from /usr/local/bundle/bin/fastlane:23:in `<main>'
+------+-------------------------+-------------+
|               fastlane summary               |
+------+-------------------------+-------------+
| Step | Action                  | Time (in s) |
+------+-------------------------+-------------+
| 1    | default_platform        | 0           |
| 2    | build_summary           | 0           |
| 3    | add_git_credentials     | 0           |
| 4    | detect_native_type      | 0           |
| 5    | get_web_dir             | 0           |
| 6    | modify_cap_web_config   | 0           |
| 7    | download_credential     | 0           |
| 8    | build_pro_app           | 130         |
| 9    | cap_sync                | 1           |
| 10   | cap_custom_deploy       | 0           |
| 💥   | build_android_capacitor | 44          |
+------+-------------------------+-------------+

[03:01:25]: fastlane finished with errors
Running after script...
$ run "clean-up"
ERROR: Job failed: command terminated with exit code 1

I think the solution is to set the variable GPS_REQUIRED to false in the AndroidManifest.xml file
replace this

<uses-feature android:name="android.hardware.location.gps" android:required="$GPS_REQUIRED"/>

with this

<uses-feature android:name="android.hardware.location.gps" android:required="false"/>

But How to do that in ionic app flow build? this is the question?

cordova-plugin-geolocation added that variable on latest release and capacitor is not able to handle it

I’ve sent a PR that would replace that variable with the default value, but you’ll have to wait for a new @capacitor/cli release or downgrade the plugin for now

Execution failed for task ‘:capacitor-cordova-android-plugins:processDebugManifest’.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

I’m facing this issue in ionic-5 also