Home > Back-end >  You uploaded an APK or Android App Bundle without 'android:exported' property set
You uploaded an APK or Android App Bundle without 'android:exported' property set

Time:09-23

my problem when upload aab on google play show this message
You uploaded an APK or Android App Bundle which has an activity, activity alias, service or broadcast receiver with intent filter, but without 'android:exported' property set.

I use xamarin forms this my android manifest

  <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.1" 
      package="com.raitotec.faruj" android:installLocation="preferExternal" android:versionCode="1">

<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31"  />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-feature android:name="android.hardware.location" android:required="false"/>
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
<application android:label="@string/app_name" android:icon="@drawable/logo" android:largeHeap="true">
    
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"  android:exported="false" />
    <receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" 
              android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter >
            <action android:name="com.google.android.c2dm.intent.RECEIVE"  />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <category android:name="${applicationId}" />
        </intent-filter>
    </receiver>
    <uses-library android:name="org.apache.http.legacy" android:required="false"  />
</application>
  </manifest> 

and Splash Screen this code

   [Activity(Label = "@string/app_name", Icon = "@drawable/Icon",
          Theme = "@style/splashscreen", MainLauncher = true, NoHistory = true,Exported =true)]
public class SplashActivity : AppCompatActivity

and MainActivity this code

[Activity(Label = "@string/app_name", Icon = "@drawable/Icon",
          Theme = "@style/MainTheme", MainLauncher = false, Exported = false,
    ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity

CodePudding user response:

I haven't used Xamarin but I have faced this issue before:
You will need Android studio to help you figure out which service/receiver.. etc that doesn't have exported=true. This is probably due to other libraries you have in your application that doesn't have exported=true.

in order to fix that:

Either use android studio and open the androidManifest file and select merged Manifest then you can scan through and highlight the one without android:exported = true or false.. and merge that to your main manifest..

other option is create an APK and analyse it using AndroidStudio and extract androidManifest file.. then scan through and highlight the ones without android:exported = true check on all the (receiver, provider, service or activity)

once you have them then you can open your app manifest file and add it as follow.. e.g for activity

<activity
        android:name="com.example.ActivityWithoutExport"
        android:exported="true"
        tools:node="merge"/>

make sure you set tools:node="merge" that will merge the new changes to the merged manifest file.

CodePudding user response:

Accord to google new policy if your app targets Android 12 or higher and contains activities, services, or broadcast receivers that use intent filters, you must explicitly declare the android:exported:true attribute for these app components. So in main manifest file check all the activities, services , receiver that can use intent-filter which are without android:exported tag.

Please add android:exported="true" or android:exported="false" for these tags. If the app component includes the LAUNCHER category, set android:exported to true otherwise set android:exported to false.

You may select merged Manifest to find activities, services, or broadcast receivers that use intent filters that do not define the android: exported attribute. If you are not able to preview Merged Manifest then in your build.gradle file set compileSdkVersion 30 and targetSdkVersion 30 and sync your project and now try to open merged manifest again I hope this time you will have proper preview of merged manifest. Please also check individual third party library manifest files if there is any activity , service or receiver using then you have to override same activity , service or receiver in your main manifest file with android:exported property. Finally, please define it in your androidManifest file as other activities:

<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"  android:exported="false" />
  • Related