Error while trying to edit manifest.xml using apktool

Hi,
I am trying to edit the app of a colegue to make possible to publish it in playstore (update to android 12). but I am getting this error:

I: Using Apktool M 2.4.0-210716
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
I: Using aapt v1.
W: /storage/emulated/0/Silva/bmotopassageiro (3)_mod_src/AndroidManifest.xml:210: error: Error parsing XML: duplicate attribute
W: 
W: a.a.b: a.b.a: could not exec (exit code = 1): [/data/user/0/ru.maximoff.apktool/files/bin/aapt_64, p, --min-sdk-version, 21, --target-sdk-version, 31, --version-code, 1000, --version-name, 1.000, --no-version-vectors, -F, /data/user/0/ru.maximoff.apktool/cache/APKTOOL2954639126662948065.tmp, -0, AndroidManifest.xml, -0, resources.arsc, -0, png, -0, jpg, -0, mp3, -0, arsc, -I, /data/user/0/ru.maximoff.apktool/files/framework/1.apk, -S, /storage/emulated/0/Silva/bmotopassageiro (3)_mod_src/res, -M, /storage/emulated/0/Silva/bmotopassageiro (3)_mod_src/AndroidManifest.xml]
W: a.a.b: a.b.a: could not exec (exit code = 1): [/data/user/0/ru.maximoff.apktool/files/bin/aapt_64, p, --min-sdk-version, 21, --target-sdk-version, 31, --version-code, 1000, --version-name, 1.000, --no-version-vectors, -F, /data/user/0/ru.maximoff.apktool/cache/APKTOOL2954639126662948065.tmp, -0, AndroidManifest.xml, -0, resources.arsc, -0, png, -0, jpg, -0, mp3, -0, arsc, -I, /data/user/0/ru.maximoff.apktool/files/framework/1.apk, -S, /storage/emulated/0/Silva/bmotopassageiro (3)_mod_src/res, -M, /storage/emulated/0/Silva/bmotopassageiro (3)_mod_src/AndroidManifest.xml]
W: a.a.a.a(Androlib.java:577)
W: a.a.a.a(Androlib.java:495)
W: a.a.a.d(Androlib.java:353)
W: a.a.a.a(Androlib.java:317)
W: ru.maximoff.apktool.c.s.a(BuildTask.java:62)
W: ru.maximoff.apktool.c.a.a(AbstractTask.java:52)
W: ru.maximoff.apktool.c.s.a(BuildTask.java:105)
W: ru.maximoff.apktool.c.a.doInBackground(Unknown Source:2)
W: android.os.AsyncTask$2.call(AsyncTask.java:333)
W: java.util.concurrent.FutureTask.run(FutureTask.java:266)
W: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W: java.lang.Thread.run(Thread.java:764)
W: a.b.a: could not exec (exit code = 1): [/data/user/0/ru.maximoff.apktool/files/bin/aapt_64, p, --min-sdk-version, 21, --target-sdk-version, 31, --version-code, 1000, --version-name, 1.000, --no-version-vectors, -F, /data/user/0/ru.maximoff.apktool/cache/APKTOOL2954639126662948065.tmp, -0, AndroidManifest.xml, -0, resources.arsc, -0, png, -0, jpg, -0, mp3, -0, arsc, -I, /data/user/0/ru.maximoff.apktool/files/framework/1.apk, -S, /storage/emulated/0/Silva/bmotopassageiro (3)_mod_src/res, -M, /storage/emulated/0/Silva/bmotopassageiro (3)_mod_src/AndroidManifest.xml]
W: a.a.c.a.a(AndrolibResources.java:459)
W: a.a.c.a.a(AndrolibResources.java:629)
W: a.a.a.a(Androlib.java:555)
W: a.a.a.a(Androlib.java:495)
W: a.a.a.d(Androlib.java:353)
W: a.a.a.a(Androlib.java:317)
W: ru.maximoff.apktool.c.s.a(BuildTask.java:62)
W: ru.maximoff.apktool.c.a.a(AbstractTask.java:52)
W: ru.maximoff.apktool.c.s.a(BuildTask.java:105)
W: ru.maximoff.apktool.c.a.doInBackground(Unknown Source:2)
W: android.os.AsyncTask$2.call(AsyncTask.java:333)
W: java.util.concurrent.FutureTask.run(FutureTask.java:266)
W: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W: java.lang.Thread.run(Thread.java:764)
W: could not exec (exit code = 1): [/data/user/0/ru.maximoff.apktool/files/bin/aapt_64, p, --min-sdk-version, 21, --target-sdk-version, 31, --version-code, 1000, --version-name, 1.000, --no-version-vectors, -F, /data/user/0/ru.maximoff.apktool/cache/APKTOOL2954639126662948065.tmp, -0, AndroidManifest.xml, -0, resources.arsc, -0, png, -0, jpg, -0, mp3, -0, arsc, -I, /data/user/0/ru.maximoff.apktool/files/framework/1.apk, -S, /storage/emulated/0/Silva/bmotopassageiro (3)_mod_src/res, -M, /storage/emulated/0/Silva/bmotopassageiro (3)_mod_src/AndroidManifest.xml]
W: a.d.f.a(OS.java:149)
W: a.a.c.a.a(AndrolibResources.java:455)
W: a.a.c.a.a(AndrolibResources.java:629)
W: a.a.a.a(Androlib.java:555)
W: a.a.a.a(Androlib.java:495)
W: a.a.a.d(Androlib.java:353)
W: a.a.a.a(Androlib.java:317)
W: ru.maximoff.apktool.c.s.a(BuildTask.java:62)
W: ru.maximoff.apktool.c.a.a(AbstractTask.java:52)
W: ru.maximoff.apktool.c.s.a(BuildTask.java:105)
W: ru.maximoff.apktool.c.a.doInBackground(Unknown Source:2)
W: android.os.AsyncTask$2.call(AsyncTask.java:333)
W: java.util.concurrent.FutureTask.run(FutureTask.java:266)
W: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
W: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W: java.lang.Thread.run(Thread.java:764)
I: Time spent: 00:00:01.205

And this is the content of the manifest.xml after edited. The only change I made was add the line text android:exported=“true” as a new line inside each <activity and <receiver tags
If someone can help me finding the error I will be very thankful:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    package="com.borademoto.passageiro"
    platformBuildVersionCode="30"
    platformBuildVersionName="11"
    android:installLocation="auto"
    android:compileSdkVersion="30"
    android:compileSdkVersionCodename="11"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <queries>
        <package
            android:name="com.google.android.apps.maps" />
    </queries>
    <permission
        android:name="io.kodular.jmvssp.bmotopassageiro.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />
    <uses-permission
        android:name="io.kodular.jmvssp.bmotopassageiro.permission.MAPS_RECEIVE" />
    <uses-feature
        android:glEsVersion="0x20000"
        android:required="true" />
    <permission
        android:name="io.kodular.jmvssp.bmotopassageiro.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission
        android:name="io.kodular.jmvssp.bmotopassageiro.permission.C2D_MESSAGE" />
    <uses-permission
        android:name="com.sonyericsson.home.permission.BROADCAST_BADGE" />
    <uses-permission
        android:name="com.htc.launcher.permission.READ_SETTINGS" />
    <uses-permission
        android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission
        android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="29" />
    <uses-permission
        android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
    <uses-permission
        android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission
        android:name="me.everything.badger.permission.BADGE_COUNT_READ" />
    <uses-permission
        android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission
        android:name="com.sec.android.provider.badge.permission.WRITE" />
    <uses-permission
        android:name="com.sec.android.provider.badge.permission.READ" />
    <uses-permission
        android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission
        android:name="android.permission.WAKE_LOCK" />
    <uses-permission
        android:name="com.anddoes.launcher.permission.UPDATE_COUNT" />
    <uses-permission
        android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission
        android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission
        android:name="com.oppo.launcher.permission.WRITE_SETTINGS" />
    <uses-permission
        android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission
        android:name="android.permission.ACTION_MANAGE_OVERLAY_PERMISSION" />
    <uses-permission
        android:name="android.permission.READ_APP_BADGE" />
    <uses-permission
        android:name="android.permission.VIBRATE" />
    <uses-permission
        android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
    <uses-permission
        android:name="com.majeur.launcher.permission.UPDATE_BADGE" />
    <uses-permission
        android:name="com.sonymobile.home.permission.PROVIDER_INSERT_BADGE" />
    <uses-permission
        android:name="com.htc.launcher.permission.UPDATE_SHORTCUT" />
    <uses-permission
        android:name="android.permission.INTERNET" />
    <uses-permission
        android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
    <uses-permission
        android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission
        android:name="android.permission.ACCESS_MOCK_LOCATION" />
    <uses-permission
        android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
    <uses-permission
        android:name="me.everything.badger.permission.BADGE_COUNT_WRITE" />
    <uses-permission
        android:name="com.oppo.launcher.permission.READ_SETTINGS" />
    <application
        android:theme="@style/AppTheme"
        android:label="Bora de Moto Passageiro"
        android:icon="@mipmap/ic_launcher"
        android:name="com.google.appinventor.components.runtime.multidex.MultiDexApplication"
        android:debuggable="false"
        android:supportsRtl="true"
        android:usesCleartextTraffic="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:roundIcon="@mipmap/ic_launcher"
        android:requestLegacyExternalStorage="true"
        android:preserveLegacyExternalStorage="true">
        <activity
            android:theme="@style/AppTheme.NoActionBar"
            android:exported="true"
            android:name="io.kodular.jmvssp.bmotopassageiro.notas"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
            android:windowSoftInputMode="stateHidden">
            <intent-filter>
                <action
                    android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>
        <activity
            android:theme="@style/AppTheme.NoActionBar"
            android:exported="true"
            android:name="io.kodular.jmvssp.bmotopassageiro.Screen1"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
            android:windowSoftInputMode="stateHidden">
            <intent-filter>
                <action
                    android:name="android.intent.action.MAIN" />
                <category
                    android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:theme="@style/AppTheme.NoActionBar"
            android:exported="true"
            android:name="io.kodular.jmvssp.bmotopassageiro.menu"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
            android:windowSoftInputMode="stateHidden">
            <intent-filter>
                <action
                    android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>
        <meta-data
            android:name="io.kodular.app.VERSION"
            android:value="1.5B.1-Fenix" />
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
        <meta-data
            android:name="onesignal_app_id"
            android:value="fa07a441-3ae3-4d48-95f0-38f3b5a8301b" />
        <receiver
            android:name="com.onesignal.GcmBroadcastReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter
                android:priority="999">
                <action
                    android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category
                    android:name="io.kodular.jmvssp.bmotopassageiro" />
            </intent-filter>
        </receiver>
        <receiver
            android:exported="true"
            android:name="com.onesignal.NotificationOpenedReceiver" />
        <service
            android:name="com.onesignal.GcmIntentService" />
        <service
            android:name="com.onesignal.GcmIntentJobService"
            android:permission="android.permission.BIND_JOB_SERVICE" />
        <service
            android:name="com.onesignal.RestoreJobService"
            android:permission="android.permission.BIND_JOB_SERVICE" />
        <service
            android:name="com.onesignal.RestoreKickoffJobService"
            android:permission="android.permission.BIND_JOB_SERVICE" />
        <service
            android:name="com.onesignal.SyncService"
            android:stopWithTask="false" />
        <service
            android:name="com.onesignal.SyncJobService"
            android:permission="android.permission.BIND_JOB_SERVICE" />
        <activity
            android:exported="true"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:name="com.onesignal.PermissionsActivity" />
        <service
            android:name="com.onesignal.NotificationRestoreService" />
        <receiver
            android:exported="true"
            android:name="com.onesignal.BootUpReceiver">
            <intent-filter>
                <action
                    android:name="android.intent.action.ACTION_BOOT_COMPLETED" />
                <action
                    android:name="android.intent.action.BOOT_COMPLETED" />
                <action
                    android:name="android.intent.action.QUICKBOOT_POWERON" />
            </intent-filter>
        </receiver>
        <receiver
            android:exported="true"
            android:name="com.onesignal.UpgradeReceiver">
            <intent-filter>
                <action
                    android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            </intent-filter>
        </receiver>
        <activity
            android:exported="true"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:name="com.google.android.gms.common.api.GoogleApiActivity"
            android:exported="false" />
        <activity
            android:exported="true"
            android:name="com.google.appinventor.components.runtime.ListPickerActivity"
            android:screenOrientation="behind"
            android:configChanges="keyboardHidden|orientation" />
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyCy4RMO_XaN7O5sqeoC4irsDOQP1cMAkTc" />
        <provider
            android:name="androidx.core.content.FileProvider"
            android:exported="false"
            android:authorities="com.borademoto.passageiro.provider"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>
        <uses-library
            android:name="org.apache.http.legacy"
            android:required="false" />
    </application>
</manifest>```

Shouldn’t it be changed to 31

Hi,
I didnt notice that part before because I only changed what was told in the tutorials I saw. And it wasn’t said to change the sdk in the manifest.xml. there is another step to change the sdk version. But I will try to change it and see if it works.
I dont think this was the problem but it is worth to try. Thanks.

1 Like

No, not needed.

if I’m not mistaken, you should do it too service as well.

Also you have

bild

Edit

If it should be android:exported true or false that I can’t say precisely

2 Likes

Update

By viewing on a different platform, service should be set to android:exported="false"

        <service android:exported="false" android:name="com.onesignal.FCMIntentService"/>
        <service android:exported="false" android:name="com.onesignal.FCMIntentJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>
        <service android:exported="false" android:name="com.onesignal.FocusDelaySyncService" android:stopWithTask="true"/>
        <service android:exported="false" android:name="com.onesignal.FocusDelaySyncJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>
        <service android:exported="false" android:name="com.onesignal.SyncService" android:stopWithTask="true"/>
        <service android:exported="false" android:name="com.onesignal.SyncJobService" android:permission="android.permission.BIND_JOB_SERVICE"/>
        <activity android:exported="false" android:name="com.onesignal.PermissionsActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
        <receiver android:exported="true" android:name="com.onesignal.NotificationDismissReceiver"/>
        <receiver android:exported="true" android:name="com.onesignal.BootUpReceiver">
1 Like