Error generating Android app (MABS 8.0)
Application Type
Mobile
Service Studio Version
11.12.3 (Build 50494)

Hi,

I'm trying to update my app's MABS version to 8.0 for a while, but I have faced different issues generating the Android one. The first time I tried to generate the app, the iOS one generated with no problems and I had this error on the Android one:


[ERROR] [Build] Command failed with exit code 1: source/platforms/android/gradlew cdvBuildDebug -b source/platforms/android/build.gradle --parallel

[ERROR] [Build] Build failed with the following error: There was an issue generating the app. Elements of type "receiver" with defined intent filters must declare a value for "android:exported" in all AndroidManifest.xml files, both in the app and Gradle dependencies. Check your plugin configurations and try again.


It is worth mentioning that I edited the cordova plugin, I did this so I could change the Plist file to add portuguese to the native components of the iOS app. My extensibility configurations look like this:


The plugin.xml of the resource is the following:


<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"

    xmlns:android="http://schemas.android.com/apk/res/android"

    id="cordova-plugin-edit-plist-file"

    version="0.0.3">

    <name>Edit Plist file</name>

    <description>

        A cordova "plugin" that helps you indicate the modifications on the iOS's *-info.plist file.

        So it avoids you to directly edit the *-info.plist file.

        For example it is used to whitelist some schemes for ios9.

        This plugin was initially created to avoid iOS 9 problems that prevent opening other apps from your own app because some used plugins aren't updated to take into consideration the new specification for iOS 9.

    </description>

    <author>Haythem OUEDERNI - haythem@nirbyapp.com </author>

    <license>MIT</license>

    <engines>

        <!-- Requires > 3.3.* because of the custom Framework tag for iOS [CB-5238] -->

        <!-- Requires > 3.5.0 because of the custom Framework tag for Android [CB-6698] -->

        <engine name="cordova" version=">=3.5.0" />

    </engines>

      <!-- ios -->

    <platform name="ios">

        <config-file target="*-Info.plist" platform="ios" parent="CFBundleLocalizations" overwrite="true">

            <array>

                <string>es</string>

                <string>pt</string>

                <string>fr</string>

                <string>it</string>

                <string>de</string>

            </array>

        </config-file>        

    </platform>

    <!-- android -->

    <platform name="android">

        <edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">

            <application android:exported="true"/>

        </edit-config>

    </platform>

 </plugin>


The part of the code that is Bold is the one that I edited afterwards, trying to resolve the Android issue, but this caused a different error:


[ERROR] [Build] There was a conflict trying to modify attributes with <edit-config> in plugin cordova-plugin-edit-plist-file. The conflicting plugin, undefined, already modified the same attributes. The conflict must be resolved before cordova-plugin-edit-plist-file can be added. You may use --force to add the plugin and overwrite the conflicting attributes.

[ERROR] [Build] Build failed with the following error: Couldn't install the Cordova plugin cordova-plugin-edit-plist-file.


I Also tried to add --force after the edit-config (edit-config--force), but this also resulted in an error. I even tried to remove all the extensibility configurations, but the same error caused on the first time (..."receiver" with defined intent filters must declare a value for "android:exported"...).


These are the plugins that I use in my app, I have already updated all of them to the most recent version.



Did any of you had a similiar problem, or know how to fix this issue?


Thanks in advance,


Tarek


I was able to find out the issue and come up with a solution.


One of the plugins I was using (Social Sharing), was injecting the "receiver" tag without declaring the "android:exported" attribute into the Android manifest file. 


To solve the issue, I downloaded the Git plugin referenced and edited the xml to add the "android:exported" attribute. Then I cloned the module and referenced the edited plugin, now have my own version that works for MABS 8.0.

Hi @Tarek Nasser Sati ,

I'm facing the same issue while generating my app can you please share  with me  the social sharing plugin clone that you have created for reference 


Thanks & Regards 


Champion

Hi Tarek,
At very first appreciate the question posted in quite a defined manner.

Can you share the MobileApp Build Log file; which is generated on ServiceCenter for the respective Platform?
It would be much easy from the log to identify the root cause plugin creating a conflict & then it makes sense to approach for any respective solution.

Thanks,
Assif


Hi Assif,


First of all, thank you for taking the time to answer the question.


This is the log file of the first error that I mentioned.

AndroidBuildLog (16).txt

And this is the second one (after trying to add android:exported="true"  in the manifest)

AndroidBuildLog (22).txt

Champion

Hi Tarek,

- The first issue Elements of type "receiver" with defined intent filters  is due to the Apps targeting Android 12 and higher are required to specify an explicit value for `android: exported` when the corresponding component has an intent filter defined; in your case, it is "receiver" 

- Now after you try to apply a fix on any respective plugin that you found; you came across a new issue of a conflict trying to modify attributes with <edit-config> in the plugin; this issue came because you still have some plugin having an intent declared without the property defined android: exported

Approach-1 :
- Remove that EditConfig patch you applied.
-Update all the plugins to the latest compatible version for MABS 8.0
- Generate Build

Approach-2
- Remove that EditConfig patch you applied.
- Check all plugins & find which plugin uses the Intent for the Android, Now you need to update all the found plugins manifest i.e they have android: exported attribute to intents and receivers
Generate Build

Good Luck,
Assif

Hi Tarek, 

I am also currently unable to generate the Android app of my application, were you able to address this issue?

MABS 8 is causing some errors with cordova plugins, I had a similar issue.

I was able to find out the issue and come up with a solution.


One of the plugins I was using (Social Sharing), was injecting the "receiver" tag without declaring the "android:exported" attribute into the Android manifest file. 


To solve the issue, I downloaded the Git plugin referenced and edited the xml to add the "android:exported" attribute. Then I cloned the module and referenced the edited plugin, now have my own version that works for MABS 8.0.

Hi @Tarek Nasser Sati ,

I'm facing the same issue while generating my app can you please share  with me  the social sharing plugin clone that you have created for reference 


Thanks & Regards 


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.