Android Question Upload to Play Store Fail, 'android:exported'

mw71

Well-Known Member
Licensed User
Longtime User
Hello,

an update that needs to be uploaded to Play Store requires Target SDK to be changed to 31.
Unfortunately, the Play Store says: "You have uploaded an APK or Android App Bundle that has an activity, activity alias, service or broadcast receiver with intent filter, but without the 'android:exported' property set."

First I updated to B4A 12.0, also with new required resources, but it doesn't help.

my manifest "File:
XML:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
    
AddActivityText(Main,
  <intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="$PACKAGE$" />
  </intent-filter>
   )
 
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute(Main, android:windowSoftInputMode, stateHidden|adjustPan)
'SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)

'SetApplicationAttribute(android:icon, "@drawable/logo")
'SetApplicationAttribute(android:logo, "@drawable/icon")
SetApplicationAttribute(android:theme, "@style/MyTheme")

SetApplicationAttribute(android:icon, "@mipmap/logo")
CreateResource(mipmap-anydpi-v26, ic_launcher.xml,
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/background"/>
    <foreground android:drawable="@mipmap/foreground"/>
</adaptive-icon>
)



'SetApplicationAttribute(android:icon, "@mipmap/ic_launcher")
'CreateResource(mipmap-anydpi-v26, ic_launcher.xml,
'<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
'<background android:drawable="@mipmap/background"/>
'<foreground android:drawable="@mipmap/foreground"/>
'</adaptive-icon>
')


CreateResourceFromFile(Macro, Core.NetworkClearText)

AddPermission(android.permission.SCHEDULE_EXACT_ALARM)

'************ File Provider ****************
'E-Mail senden ab Android 6+
'AddManifestText(<uses-permission
'    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
'    android:maxSdkVersion="18" />
')
'AddManifestText(<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>)
AddPermission("android.permission.WRITE_EXTERNAL_STORAGE")


'29.4.21, entfernt wegen vorbereitung auf Android 11
'SetApplicationAttribute(android:requestLegacyExternalStorage, true)

AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="" />
)
'Ende of File Provider


'CrashReport
'https://www.b4x.com/android/forum/threads/crashlytics-crash-reports.87510/
AddApplicationText(
 <provider
            android:name="com.crashlytics.android.CrashlyticsInitProvider"
            android:authorities="$PACKAGE$.crashlyticsinitprovider"
            android:exported="false"
            android:initOrder="100" />
           )
          
CreateResource(values, com_crashlytics_build_id.xml,
<resources xmlns:tools="http://schemas.android.com/tools">
<string tools:ignore="UnusedResources,,TypographyDashes" name="com.crashlytics.android.build_id"
   translatable="false">cc7c8eddb7024f38a1b4491ef214b8f7</string>
</resources>)


'Firebase
'https://www.b4x.com/android/forum/threads/integrating-firebase-services.67692/#content

'************ Google Play Services Base ************
AddApplicationText(
   <activity android:name="com.google.android.gms.common.api.GoogleApiActivity"
  android:theme="@android:style/Theme.Translucent.NoTitleBar"
  android:exported="false"/>
    <meta-data
  android:name="com.google.android.gms.version"
  android:value="@integer/google_play_services_version" />
)
'************ Google Play Services Base (end) ************

'************ Firebase Base ************
CreateResourceFromFile("google-services", "google-services.json")
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
AddPermission(${applicationId}.permission.C2D_MESSAGE)
AddManifestText( <permission android:name="${applicationId}.permission.C2D_MESSAGE"
  android:protectionLevel="signature" />)
AddApplicationText(
<receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  android:exported="false"/>
   <provider
  android:authorities="${applicationId}.firebaseinitprovider"
  android:name="com.google.firebase.provider.FirebaseInitProvider"
  android:exported="false"
  android:initOrder="100" />
    <receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  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>
    <receiver
  android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
  android:exported="false" />


  <service
  android:name="com.google.firebase.iid.FirebaseInstanceIdService"
  android:exported="true">
  <intent-filter android:priority="-500">
  <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
  </intent-filter>
  </service>
)
'************ Firebase Base (end) ************

'************ Firebase Analytics ************
AddApplicationText(
  <receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  android:exported="false"/>

  <service android:name="com.google.firebase.crash.internal.service.FirebaseCrashReceiverService"
  android:process=":background_crash"/>

  <service android:name="com.google.firebase.crash.internal.service.FirebaseCrashSenderService"
  android:process=":background_crash"/>
)
'************ Firebase Analytics (end) ************

'Checkbox
CreateResource(layout, checkbox.xml,
  <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/chk1"

  android:layout_width="85dip"
  android:layout_height="55dip"
  android:button="@null"
android:drawableRight="?android:attr/listChoiceIndicatorMultiple"

  android:tag="chk1" />
)

'  android:layout_left="235dp"
'  android:layout_top="75dp"

'Checkbox ende
 

mw71

Well-Known Member
Licensed User
Longtime User
Thanks for answer, but it doesn't help ?
I think i have not found the correct place (test 3 diffrent)

"New" Manifest:
XML:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"
    />)
   
AddActivityText(Main,
  <intent-filter>
  <action android:name="android.intent.action.VIEW" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="$PACKAGE$"/>
  android:exported="true"
  </intent-filter>
   )
 

SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute(Main, android:windowSoftInputMode, stateHidden|adjustPan)
'SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)

'SetApplicationAttribute(android:icon, "@drawable/logo")
'SetApplicationAttribute(android:logo, "@drawable/icon")
SetApplicationAttribute(android:theme, "@style/MyTheme")

SetApplicationAttribute(android:icon, "@mipmap/logo")
CreateResource(mipmap-anydpi-v26, ic_launcher.xml,
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/background"/>
    <foreground android:drawable="@mipmap/foreground"/>
</adaptive-icon>
)




'SetApplicationAttribute(android:icon, "@mipmap/ic_launcher")
'CreateResource(mipmap-anydpi-v26, ic_launcher.xml,
'<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
'<background android:drawable="@mipmap/background"/>
'<foreground android:drawable="@mipmap/foreground"/>
'</adaptive-icon>
')


CreateResourceFromFile(Macro, Core.NetworkClearText)

AddPermission(android.permission.SCHEDULE_EXACT_ALARM)

'************ File Provider ****************
'E-Mail senden ab Android 6+
'AddManifestText(<uses-permission
'    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
'    android:maxSdkVersion="18" />
')
'AddManifestText(<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>)
AddPermission("android.permission.WRITE_EXTERNAL_STORAGE")


'29.4.21, entfernt wegen vorbereitung auf Android 11
'SetApplicationAttribute(android:requestLegacyExternalStorage, true)

AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="" />
)
'Ende of File Provider


'CrashReport
'https://www.b4x.com/android/forum/threads/crashlytics-crash-reports.87510/
AddApplicationText(
 <provider
            android:name="com.crashlytics.android.CrashlyticsInitProvider"
            android:authorities="$PACKAGE$.crashlyticsinitprovider"
            android:exported="false"
            android:initOrder="100" />
           )
         
CreateResource(values, com_crashlytics_build_id.xml,
<resources xmlns:tools="http://schemas.android.com/tools">
<string tools:ignore="UnusedResources,,TypographyDashes" name="com.crashlytics.android.build_id"
   translatable="false">cc7c8eddb7024f38a1b4491ef214b8f7</string>
</resources>)


'Firebase
'https://www.b4x.com/android/forum/threads/integrating-firebase-services.67692/#content

'************ Google Play Services Base ************
AddApplicationText(
   <activity android:name="com.google.android.gms.common.api.GoogleApiActivity"
  android:theme="@android:style/Theme.Translucent.NoTitleBar"
  android:exported="false"/>
    <meta-data
  android:name="com.google.android.gms.version"
  android:value="@integer/google_play_services_version" />
)
'************ Google Play Services Base (end) ************

'************ Firebase Base ************
CreateResourceFromFile("google-services", "google-services.json")
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WAKE_LOCK)
AddPermission(com.google.android.c2dm.permission.RECEIVE)
AddPermission(${applicationId}.permission.C2D_MESSAGE)
AddManifestText( <permission android:name="${applicationId}.permission.C2D_MESSAGE"
  android:protectionLevel="signature" />)
AddApplicationText(
<receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  android:exported="false"/>
   <provider
  android:authorities="${applicationId}.firebaseinitprovider"
  android:name="com.google.firebase.provider.FirebaseInitProvider"
  android:exported="false"
  android:initOrder="100" />
    <receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  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>
    <receiver
  android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver"
  android:exported="false" />


  <service
  android:name="com.google.firebase.iid.FirebaseInstanceIdService"
  android:exported="true">
  <intent-filter android:priority="-500">
  <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
  </intent-filter>
  </service>
)
'************ Firebase Base (end) ************

'************ Firebase Analytics ************
AddApplicationText(
  <receiver
  android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
  android:enabled="true">
  <intent-filter>
  <action android:name="com.google.android.gms.measurement.UPLOAD"/>
  </intent-filter>
  </receiver>

  <service
  android:name="com.google.android.gms.measurement.AppMeasurementService"
  android:enabled="true"
  android:exported="false"/>

  <service android:name="com.google.firebase.crash.internal.service.FirebaseCrashReceiverService"
  android:process=":background_crash"/>

  <service android:name="com.google.firebase.crash.internal.service.FirebaseCrashSenderService"
  android:process=":background_crash"/>
)
'************ Firebase Analytics (end) ************

'Checkbox
CreateResource(layout, checkbox.xml,
  <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/chk1"

  android:layout_width="85dip"
  android:layout_height="55dip"
  android:button="@null"
android:drawableRight="?android:attr/listChoiceIndicatorMultiple"

  android:tag="chk1" />
)

'  android:layout_left="235dp"
'  android:layout_top="75dp"

'Checkbox ende
 
Upvote 0

mw71

Well-Known Member
Licensed User
Longtime User
thank you Erel, it works.

a other problem with GPS on Andoid 12 and above is also fixed.
 
Upvote 0
Top