Gradle sync failed: Cannot read packageName - android

I have tried so many solutions but none worked. It would be great if someone could help here.I have imported this project which has API 21 however, I have API 26. If you want to know any further details from the code, please let me know. I have completely no idea where I went wrong so it would be nice if anyone can tell me what are the possible fixes for this situation?
manifest file is as follows:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapps.documentscanner"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".DocumentScannerApplication"
android:allowBackup="true"
android:fullBackupContent="false"
android:hardwareAccelerated="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat">
<receiver android:name="WidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/simple_widget_info" />
</receiver>
<meta-data
android:name="com.google.android.gms.vision.DEPENDENCIES"
android:value="ocr" />
<!--
Optionally, register AnalyticsReceiver and AnalyticsService to support background
dispatching on non-Google Play devices
-->
<receiver
android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false" />
<!--
Optionally, register CampaignTrackingReceiver and CampaignTrackingService to enable
installation campaign reporting
-->
<receiver
android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />
<activity
android:name=".DocumentScannerActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/title_activity_document_scanner"
android:screenOrientation="portrait"
android:theme="#style/FullscreenTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.media.action.IMAGE_CAPTURE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".GalleryGridActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/title_activity_gallery"
android:screenOrientation="portrait"
android:theme="#style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:name=".SavedTextsList"
android:label="#string/saved_texts_list"
android:launchMode="singleTask"
android:parentActivityName=".OcrCaptureActivity"
android:theme="#style/FullscreenTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".OcrCaptureActivity" />
</activity>
<!-- todo 5: Add provider to AndroidManifest.xml -->
<provider
android:name="com.myapps.documentscanner.data.TextProvider"
android:authorities="com.myapps.documentscanner" />
<activity
android:name=".TextDetailActivity"
android:label="#string/edit_text_detail"
android:parentActivityName=".SavedTextsList"
android:theme="#style/FullscreenTheme">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".SavedTextsList" />
</activity>
<activity
android:name=".FullScreenViewActivity"
android:label="#string/title_activity_full_image"
android:theme="#style/FullscreenTheme" />
<activity
android:name=".SettingsActivity"
android:label="#string/settings"
android:theme="#style/AppTheme" />
<activity
android:name=".OcrCaptureActivity"
android:label="Read Text"
android:parentActivityName=".DocumentScannerActivity"
android:theme="#style/AppTheme">
<!-- The meta-data element is needed for versions lower than 4.1 -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".DocumentScannerActivity" />
</activity><!-- ATTENTION: This was auto-generated to add Google Play services to your project for
App Indexing. See https://g.co/AppIndexing/AndroidStudio for more information. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
</manifest>
The build.gradle file is as follows:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.myapps.documentscanner"
minSdkVersion 21
targetSdkVersion 23
versionCode 3
versionName '2.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
enable true
// By default all ABIs are included, so use reset() and include to specify that we only
// want APKs for x86, armeabi-v7a, and mips.
// Resets the list of ABIs that Gradle should create APKs for to none.
reset()
// Specifies a list of ABIs that Gradle should create APKs for.
include "x86", "armeabi-v7a", "mips" , 'armeabi'
// Specifies that we do not want to also generate a universal APK that includes all ABIs.
universalApk false
}
}
}
// Map for the version code that gives each ABI a value.
ext.abiCodes = ['armeabi':1, 'armeabi-v7a':2, mips:3, x86:4]
// For per-density APKs, create a similar map like this:
// ext.densityCodes = ['mdpi': 1, 'hdpi': 2, 'xhdpi': 3]
import com.android.build.OutputFile
// For each APK output variant, override versionCode with a combination of
// ext.abiCodes * 1000 + variant.versionCode. In this example, variant.versionCode
// is equal to defaultConfig.versionCode. If you configure product flavors that
// define their own versionCode, variant.versionCode uses that value instead.
android.applicationVariants.all { variant ->
// Assigns a different version code for each output APK
// other than the universal APK.
variant.outputs.each { output ->
// Stores the value of ext.abiCodes that is associated with the ABI for this variant.
def baseAbiVersionCode =
// Determines the ABI for this variant and returns the mapped value.
project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
// Because abiCodes.get() returns null for ABIs that are not mapped by ext.abiCodes,
// the following code does not override the version code for universal APKs.
// However, because we want universal APKs to have the lowest version code,
// this outcome is desirable.
if (baseAbiVersionCode != null) {
// Assigns the new version code to versionCodeOverride, which changes the version code
// for only the output APK, not for the variant itself. Skipping this step simply
// causes Gradle to use the value of variant.versionCode for the APK.
output.versionCodeOverride =
baseAbiVersionCode * 1000 + variant.versionCode
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.zxing:core:3.0.1'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.afollestad:drag-select-recyclerview:0.3.6'
compile 'com.github.nostra13:Android-Universal-Image-Loader:v1.9.5'
compile 'com.github.fafaldo:fab-toolbar:1.2.0'
compile 'com.google.android.gms:play-services-analytics:9.2.1'
compile 'com.google.android.gms:play-services-vision:9.2.1'
compile 'com.google.android.gms:play-services-appindexing:9.2.1'
compile project(':openCVLibrary310')
}
apply plugin: 'com.google.gms.google-services'
Error is : Error:Cannot read packageName from E:\Document-Scanner-master\src\main\AndroidManifest.xml

Related

Manifest merger failed : android:exported needs to be explicitly specified for element [duplicate]

After upgrading to android 12, the application is not compiling. It shows
"Manifest merger failed with multiple errors, see logs"
Error showing in Merged manifest:
Merging Errors:
Error: android:exported needs to be explicitly specified for . 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. main manifest (this file)
I have set all the activity with android:exported="false". But it is still showing this issue.
My manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.siacs.conversations">
<uses-sdk tools:overrideLibrary="net.ypresto.androidtranscoder" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<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" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<application
android:name=".Application"
android:allowBackup="false"
android:allowClearUserData="true"
android:appCategory="social"
android:hardwareAccelerated="true"
android:icon="#mipmap/ic_app_launch"
android:label="#string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="#xml/network_security_configuration"
android:requestLegacyExternalStorage="true"
android:roundIcon="#mipmap/ic_app_launch_round"
android:theme="#style/ConversationsTheme"
android:usesCleartextTraffic="true"
android:windowSoftInputMode="adjustPan|adjustResize"
tools:replace="android:label"
tools:targetApi="q">
<activity
android:name=".ui.search.GroupSearchActivity"
android:exported="true" />
<activity
android:name=".ui.profileUpdating.FavouritesActivity"
android:exported="true" />
<activity
android:name=".ui.profileUpdating.NameActivity"
android:exported="true" />
<activity
android:name=".ui.CompulsoryUpdateActivity"
android:exported="true" />
<activity android:name=".ui.payments.doPayment.DoPaymentActivity"
android:exported="true" />
<activity android:name=".ui.individualList.IndividualListActivity"
android:exported="true" />
<activity android:name=".ui.payments.setPayment.SetPaymentActivity"
android:exported="true" />
<activity android:name=".ui.login.otpActivity.OTPActivity"
android:exported="true" />
<activity android:name=".ui.login.loginActivity.LoginActivity"
android:exported="true" />
<service android:name=".services.XmppConnectionService" android:exported="true" />
<receiver android:name=".services.EventReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
<action android:name="android.media.RINGER_MODE_CHANGED" />
</intent-filter>
</receiver>
<activity
android:name=".ui.ShareLocationActivity"
android:label="#string/title_activity_share_location"
android:exported="true"/>
<activity
android:name=".ui.SearchActivity"
android:label="#string/search_messages"
android:exported="true" />
<activity
android:name=".ui.RecordingActivity"
android:configChanges="orientation|screenSize"
android:theme="#style/ConversationsTheme.Dialog"
android:exported="true" />
<activity
android:name=".ui.ShowLocationActivity"
android:label="#string/title_activity_show_location"
android:exported="true" />
<activity
android:name=".ui.SplashActivity"
android:theme="#style/SplashTheme"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.ConversationsActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:minWidth="300dp"
android:minHeight="300dp"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.ScanActivity"
android:screenOrientation="portrait"
android:exported="true"
android:theme="#style/ConversationsTheme.FullScreen"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".ui.UriHandlerActivity"
android:label="#string/app_name"
android:exported="true">
<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="xmpp" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="im.app.in" />
<data android:pathPrefix="/i/" />
<data android:pathPrefix="/j/" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="imto" />
<data android:host="jabber" />
</intent-filter>
</activity>
<activity
android:name=".ui.StartConversationActivity"
android:label="#string/title_activity_start_conversation"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".ui.SettingsActivity"
android:label="#string/title_activity_settings"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
</intent-filter>
</activity>
<activity
android:name=".ui.ChooseContactActivity"
android:label="#string/title_activity_choose_contact"
android:exported="true" />
<activity
android:name=".ui.BlocklistActivity"
android:label="#string/title_activity_block_list"
android:exported="true"/>
<activity
android:name=".ui.ChangePasswordActivity"
android:label="#string/change_password_on_server"
android:exported="true"/>
<activity
android:name=".ui.ChooseAccountForProfilePictureActivity"
android:enabled="false"
android:label="#string/choose_account"
android:exported="true">
<intent-filter android:label="#string/set_profile_picture">
<action android:name="android.intent.action.ATTACH_DATA" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity
android:name=".ui.ShareViaAccountActivity"
android:label="#string/title_activity_share_via_account"
android:launchMode="singleTop"
android:exported="true" />
<activity
android:name=".ui.EditAccountActivity"
android:launchMode="singleTop"
android:exported="true"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".ui.ConferenceDetailsActivity"
android:label="#string/action_muc_details"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.ContactDetailsActivity"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.PublishProfilePictureActivity"
android:label="#string/mgmt_account_publish_avatar"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.PublishGroupChatProfilePictureActivity"
android:exported="true"
android:label="#string/group_chat_avatar" />
<activity
android:name=".ui.ShareWithActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<!-- the value here needs to be the full class name; independent of the configured applicationId -->
<meta-data
android:name="android.service.chooser.chooser_target_service"
android:value="eu.siacs.conversations.services.ContactChooserTargetService" />
</activity>
<activity
android:name=".ui.TrustKeysActivity"
android:label="#string/trust_omemo_fingerprints"
android:exported="true"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:exported="true"
android:theme="#style/Base.Theme.AppCompat" />
<activity android:name=".ui.MemorizingActivity"
android:exported="true" />
<activity
android:name=".ui.MediaBrowserActivity"
android:exported="true"
android:label="#string/media_browser" />
<service android:name=".services.ExportBackupService" android:exported="true"/>
<service android:name=".services.ImportBackupService" android:exported="true"/>
<service
android:name=".services.ContactChooserTargetService"
android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.service.chooser.ChooserTargetService" />
</intent-filter>
</service>
<service android:name=".services.CompulsoryUpdateService" android:exported="true"/>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.files"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
<provider
android:name=".services.BarcodeProvider"
android:authorities="${applicationId}.barcodes"
android:exported="false"
android:grantUriPermissions="true" />
<activity
android:name=".ui.ShortcutActivity"
android:label="#string/contact"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
</intent-filter>
</activity>
<activity
android:name=".ui.MucUsersActivity"
android:exported="true"
android:label="#string/group_chat_members" />
<activity
android:name=".ui.ChannelDiscoveryActivity"
android:exported="true"
android:label="#string/discover_channels" />
<activity
android:name=".ui.RtpSessionActivity"
android:autoRemoveFromRecents="true"
android:exported="true"
android:launchMode="singleInstance"
android:supportsPictureInPicture="true" />
</application>
</manifest>
My second manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.siacs.conversations">
<application tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".ui.ManageAccountActivity"
android:label="#string/title_activity_manage_accounts"
android:launchMode="singleTask"
android:exported="true"/>
<activity
android:name=".ui.MagicCreateActivity"
android:label="#string/create_new_account"
android:launchMode="singleTask"
android:exported="true"/>
<activity
android:name=".ui.EasyOnboardingInviteActivity"
android:label="#string/invite_to_app"
android:launchMode="singleTask" />
<activity
android:name=".ui.ImportBackupActivity"
android:label="#string/restore_backup"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.conversations.backup" />
<data android:scheme="content" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.conversations.backup" />
<data android:scheme="file" />
</intent-filter>
<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="content" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.ceb" />
<data android:pathPattern=".*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
</intent-filter>
<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="file" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.ceb" />
<data android:pathPattern=".*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
</intent-filter>
</activity>
</application>
</manifest>
My gradle file:
import com.android.build.OutputFile
// Top-level build file where you can add configuration options common to all
// sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.21"
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
configurations {
conversationsFreeCompatImplementation
}
dependencies {
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.sufficientlysecure:openpgp-api:10.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.exifinterface:exifinterface:1.3.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.emoji:emoji:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
conversationsFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0'
implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
//zxing stopped supporting Java 7 so we have to stick with 3.3.3
//https://github.com/zxing/zxing/issues/1170
implementation 'com.google.zxing:core:3.4.1'
implementation 'de.measite.minidns:minidns-hla:0.2.4'
implementation 'me.leolin:ShortcutBadger:1.1.22#aar'
implementation 'org.whispersystems:signal-protocol-java:2.8.1'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation "com.wefika:flowlayout:0.4.1"
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.3.0'
implementation 'org.jxmpp:jxmpp-jid:1.0.1'
implementation 'org.osmdroid:osmdroid-android:6.1.10'
implementation 'org.hsluv:hsluv:0.2'
implementation 'org.conscrypt:conscrypt-android:2.5.2'
implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation "com.leinardi.android:speed-dial:3.2.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.2"
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'com.google.guava:guava:30.1.1-android'
implementation 'org.webrtc:google-webrtc:1.0.32006'
// Lifecycle Helper
implementation "androidx.activity:activity-ktx:1.3.0-rc02"
implementation "androidx.fragment:fragment-ktx:1.3.6"
//Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
//CardView
implementation "androidx.cardview:cardview:1.0.0"
//Country Code Picker
implementation 'com.hbb20:ccp:2.5.3'
//Firebase
implementation 'com.google.firebase:firebase-bom:28.3.0'
implementation 'com.google.firebase:firebase-auth-ktx:21.0.1'
implementation 'androidx.browser:browser:1.3.0'
//OTP view
implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.2'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//Gson
implementation 'com.google.code.gson:gson:2.8.7'
//Multidex
implementation 'androidx.multidex:multidex:2.0.1'
//Round Image
implementation 'de.hdodenhof:circleimageview:3.1.0'
// Button with image and text
implementation 'com.github.Omega-R:OmegaCenterIconButton:0.0.4#aar'
//Razor pay
implementation 'com.razorpay:checkout:1.6.10'
//Mixpanel Tracking
implementation 'com.mixpanel.android:mixpanel-android:5.9.1'
//Loading screen
implementation 'com.wang.avi:library:2.1.3'
//Loading
implementation 'com.wang.avi:library:2.1.3'
//Form
implementation 'com.quickbirdstudios:surveykit:1.1.0'
}
ext {
travisBuild = System.getenv("TRAVIS") == "true"
preDexEnabled = System.getProperty("pre-dex", "true")
abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
}
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 24
targetSdkVersion 31
versionCode 44
versionName "2.0.4"
multiDexEnabled = true
archivesBaseName += "-$versionName"
applicationId "com.app.app"
resValue "string", "applicationId", applicationId
def appName = "app"
resValue "string", "app_name", appName
buildConfigField "String", "APP_NAME", "\"$appName\""
}
splits {
abi {
universalApk true
enable true
}
}
configurations {
compile.exclude group: 'org.jetbrains' , module:'annotations'
}
dataBinding {
enabled true
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
jumboMode true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions("mode", "distribution", "emoji")
productFlavors {
conversations {
dimension "mode"
}
free {
dimension "distribution"
versionNameSuffix "+f"
}
compat {
dimension "emoji"
versionNameSuffix "c"
}
}
sourceSets {
conversationsFreeCompat {
java {
srcDir 'src/freeCompat/java'
srcDir 'src/conversationsFree/java'
}
}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
versionNameSuffix "r"
}
debug {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
versionNameSuffix "d"
}
}
if (new File("signing.properties").exists()) {
Properties props = new Properties()
props.load(new FileInputStream(file("signing.properties")))
signingConfigs {
release {
storeFile file(props['keystore'])
storePassword props['keystore.password']
keyAlias props['keystore.alias']
keyPassword props['keystore.password']
}
}
buildTypes.release.signingConfig = signingConfigs.release
}
lintOptions {
disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
}
subprojects {
afterEvaluate {
if (getPlugins().hasPlugin('android') ||
getPlugins().hasPlugin('android-library')) {
configure(android.lintOptions) {
disable 'AndroidGradlePluginVersion', 'MissingTranslation'
}
}
}
}
packagingOptions {
exclude 'META-INF/BCKEY.DSA'
exclude 'META-INF/BCKEY.SF'
}
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
if (baseAbiVersionCode != null) {
output.versionCodeOverride = (100 * variant.versionCode) + baseAbiVersionCode
}
}
}
}
I had this issue and one of the libraries I used wasn't setting it correctly.
Find location
First of all, we need to find the exact location and/or cause for the error,
which can be done with different approaches (see below).
Find by inspecting merged-manifest (approach #1)
You can find it by doing the steps:
Set target SDK to 30 (to silence 31+ errors).
Open application's manifest (AndroidManifest.xml) and click on "Merged Manifest" tab on bottom of your edit pane:
Which if you configure build.gradle like:
allprojects {
buildDir = "${rootProject.rootDir}/build/${project.name}"
}
Something similar should be in a sub-path like:
build/my-app/intermediates/merged_manifest/debug/AndroidManifest.xml
Go to the individual manifest file of all the libraries (You can skip this step if the merged manifest is created and you can just look into the merged manifest)
Search if there's any entry of type activity, service, receiver, or provider which does not have an exported attribute, and for each entry follow below "Fix found entries" section (or see once for how to set exported attribute).
Set target SDK back to 31 (or whatever it was before changing to 30).
Find by console logs (approach #2)
In Git-bash run something like:
./gradlew assembleDebug --stacktrace --info | tee my-logs.txt
Open my-logs.txt file (which previous step created, in your preferred text-editor).
Now, the exact location is hidden in the logs,
hence search in the created my-logs.txt file,
for these keywords:
activity#
service#
receiver#
provider#
Which should find something like:
activity#androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity
ADDED from [androidx.test:core:1.2.0] C:\Users\Admin\.gradle\caches\transforms-3\709730c74fe4dc9f8fd991eb4d1c2adc\transformed\jetified-core-1.2.0\AndroidManifest.xml:27:9-33:20
Open AndroidManifest.xml file that previous steps did find, search if there's any entry of type activity, service, receiver, or provider which does not have an exported attribute, and see below "Fix found entries" section (for how to set each entries exported attribute).
Note that (at time of writting) passing --stacktrace alone did not include location info ;-)
Fix found entries
If the real (not build-generated) source of found entry is in root-project's manifest (or somewhere you can alter),
set exported attribute to corresponding need (which is normally false) therein directly, like:
<receiver
android:name="<name_of_the_entry>"
android:exported="false or true"
tools:node="merge" />
Note that both android:exported="..." and tools:node="merge" are set above.
But if found entry's specification is written in the manifest of a third-party library (which's real-source you can't alter),
override the specification of said library by adding it to our root-project's manifest, for example like:
<provider
android:name="com.squareup.picasso.PicassoProvider"
android:exported="false"
tools:node="merge"
tools:overrideLibrary="com.squareup.picasso.picasso" />
Note that this time tools:overrideLibrary="..." is set as well.
For more information see Documentation,
and/or Similar issue in a SDK.
Fixing such issue can be a bit cumbersome, cause the IDE doesn't provide details on the error, it just tells you that there is an Activity, Receiver or Service without the exported parameter, but does not tell you which one it is. As Jakos recommend, you can manually check the merged manifest, or use this script in case the generated manifest is too large.
After that you can modify the affected entries by adding the exported attribute if it is part of your project, or override it if it's part of a library with:
<activity android:name="name_of_the_activity_inside_library>"
android:exported="false|true"
tools:node="merge" />
UPDATE:
The manifest merge task seems to fail without generating the manifest when targeting android S and this problems are detected, so my advise is to compile the app using a targetSdk lower than 31, and then inspect the generated manifest either manually or using the script I linked. (you can find the merged manifest on the build folder or by inspecting the generated apk)
Change targetSdkVersion back to 30
You can leave compileSdkVersion at 31
Then hit Run
For instrumented test, if you are using compose test, make sure you add androidx.test.ext:junit in addition to compose.ui dependencies
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.4"
After the build has failed go to AndroidManifest.xml and in the bottom click merged manifest see which activities which have intent-filter but don't have exported=true attribute.
Or you can just get the activities which are giving error.
Add these activities to your App manifest with android:exported="true" and app tools:node="merge" this will add exported attribute to the activities giving error.
Example:
<activity
android:name="<activity which is giving error>"
android:exported="true"
tools:node="merge" />
You will have to do this once, you can remove this once the library developers update their libs.
Check your build.gradle file for:
debugImplementation "androidx.fragment:fragment-testing:<version>"
and if present change it to:
androidTestImplementation "androidx.fragment:fragment-testing:<version>"
It should always have been androidTestImplementation but there was some dependency issue before and it was necessary to use debugImplementation as a workaround. The IDE actually prompted you to do this. But evidently it is fixed for SDK 31, and if you leave it as debugImplementation you get the android:exported-missing manifest error which comes from a manifest.xml in a dependent package.
as the target sdk update to 31 android 12 so for that you have to do android export in your activity luncher in manifest.xml
android:exported="true"
The problem in my case was the test:core:1.3.0 (see screen shot).
I had to override the manifest entries for this library and declare the android:exported property:
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="true"
tools:node="merge"/>
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="true"
tools:node="merge"/>
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="true"
tools:node="merge"/>
<activity
android:name=".MainActivity"
android:exported="true" <** add this line on AndroidManifest.xml**
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
</activity>
I'm not sure what you're using to code, but in order to set it in Android Studio, open the manifest of your project and under the "activity" section, put android:exported="true"(or false if that is what you prefer). I have attached an example.
I happen to know that issue in the android 12 specifically. There is already a bug raised in Android SDK. In the solution of your problem here is a file you can add in android studio and run the method.
Enable android exported file
Then run the def methods and try to build.
It is tried and tested working method.
If your app targets Android 12 or higher, you must declare these attribution tags in your app's manifest file.
If the app component includes the LAUNCHER category, set android:exported to true.
<activity
android:name="com.test.activity.SplashActivity"
android:clearTaskOnLaunch="true"
android:label="#string/app_name"
android:launchMode="singleTop"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:exported="true">
Also check receiver or service in Androidmanifest, if you are using any receiver or service set android:exported="true" or false according requirement.
<receiver
android:name="com.test.receiver.ShareReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.test.fcm.android.action.broadcast" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.tagmanager.InstallReferrerService"
android:exported="true" />
Also update all your gradle dependency.
I have updated following dependency as per requirement.
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
Hope it will help you as well.
if you are using flutter , upgrading flutter_local_notifications to the latest version (now is 9.3.2) may solve this error..
If you sure about adding exported to every element in manifest file and still got this error, simply :
switch to project directory and open merged manifest file in app\build\intermediates\merged_manifest
search for any component that contains intent-filter and didn't have exported attribute
override this component in your manifest file by copy past it to your main manifest file
tip: if you can't find merged file because it's already failed to generate it .temporary downgrade to targetSdkVersion 30 and compileSdkVersion 30 and build project to generate this file and then follow above steps and then upgrade to 31 (android 12)
This is the most common issue after upgrading your TargetSDK 32 or Android Studio with API Android 12 support.
To relate this was my error:
The errors were:
Error:
android:exported needs to be explicitly specified for element <receiver#com.onesignal.BootUpReceiver>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
D:\iptvapp\iptvapp\app\src\main\AndroidManifest.xml:99:9-103:20 Error:
android:exported needs to be explicitly specified for element <receiver#com.onesignal.UpgradeReceiver>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
Then by using the merged Mainfest Clikc on the Libirary that has error for instacne
onesingal.
Then copy the error if its the receiver part and add it to your main manifest file as follows with
android:exported
set to true on.
and them
<receiver android:name="com.onesignal.BootUpReceiver" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<receiver android:name="com.onesignal.UpgradeReceiver" android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
worked like a charm!
Found this solution here, works for me. This is given by official razorpay github. They've mentioned they'll fix it in next release.
<receiver
android:name="com.razorpay.RzpTokenReceiver"
android:exported="false">
<intent-filter>
<action android:name="rzp.device_token.share" />
</intent-filter>
</receiver>
<activity
android:name="com.razorpay.CheckoutActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:exported="true"
android:theme="#style/CheckoutTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data
android:host="rzp.io"
android:scheme="io.rzp" />
</intent-filter>
</activity>
Case 1: No submodules or libraries
This issue started with SDK 31. If you don't have any libraries or submodules add
android:exported="true" <!-- or false as required -->
You can right click on the tag and Android Studio will suggest you.
Case 2: With submodules or libraries
If you have other libraries or modules that you are importing, you have to override them too. For that see the tab 'Merged Manifest'.
OR You can open
<ProjectRoot>/app/build/intermediates/merged_manifest/<your
flavor>/AndroidManifest.xml
in an editor. I prefer the second method as Merged manifest doesn't allow to search from Android Studio.
Copy <activity>, <receiver> or any others causing build errors.
Paste them to Main Manifest
Add android:exported="true" or android:exported="false" as required
Rebuild
Case 3: If None of the above works
If none of the above works, you will have to wait until your library provider makes necessary changes. Until they make changes, you may revert SDK version to 30 or lower. Lowering sdk should fix the issue temporarily.
My problem was that we were using older hilt version 2.38.1:
"com.google.dagger:hilt-android:2.38.1"
"com.google.dagger:hilt-android-gradle-plugin:2.38.1"
"com.google.dagger:hilt-android-compiler:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1" under the hood depends on core testing library 1.3.0, which does set exported properties.
To fix this, make sure you are using latest dagger hilt version (2.40.5 works):
"com.google.dagger:hilt-android:2.40.5"
"com.google.dagger:hilt-android-gradle-plugin:2.40.5"
"com.google.dagger:hilt-android-compiler:2.40.5"
"com.google.dagger:hilt-android-testing:2.40.5"
In my case I update fragment-testing to 1.5.3 version and this helped me:
dependencies {
debugImplementation androidx.fragment:fragment-testing:1.5.3
}
Just add these in build.gradle...
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.3.3"
Works like charm!
I was getting this error thrown what targeting sdk 31 and found that the solution was in my build.gradle file. I was using implementation on my compose test dependency instead of testImplementation.
Seems unrelated I know but when you look at your merge manifest with a misused test dependency you will see tags added for InstrumentedActivity which will be missing the exported=true field.
Quoting official docs about this behavior change in android 12, you should look for activities containing intent-filter and those are the ones that need to be updated by setting explicitly the value of android:exported.
Build logs should point exactly to the activity with undeclared exported flag that stopped your build. You should see something like this between the last lines of the console's output of install gradle's commands:
> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/xxxxx.tmp/base.apk (at Binary XML file line #129): YOUR.FULLY.QUALIFIED.NAME.FAILING.ACTIVITY: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present
YOUR.FULLY.QUALIFIED.NAME.FAILING.ACTIVITY should point you to the specific activity that is blocking your build.
Here is also the link to the implications of setting android:exported.
For people with problems still using Flutter, in addition to putting exported=true in the application's <activity, you need to put it in the <activity of the installed plugins.
As I use the simpleauthflutter package, it generates an activity in androidmanifest and I put exported=true. That's the only way to work.
It will look like this:
Add
tools:node="merge"
to
<activity...
and upgrade
androidx.core.test
to latest version.
Will work like a charm :)
Copy and paste the gradle script above the root build.gradle file
Gradle Script for Android 12 Required Merge
And execute the task
doAddAndroidExportedIfNecessary
(for Add Automatically the tag required to missing activity - service - receiver )
doAddAndroidExportedForDependencies
(for Add Automatically the tag required to Dependencies missing activity - service - receiver )
Hope this script can resolved your problem
This error occur when we make the targetSkdVersion=31 for latest version 12, and the error cause if we have not use android:exported="true" in the launcher activity and android:exported="false" in other intent_filter,service or broadcast receiver.
We should write android:exported="true" only for launcher activity like this:
<activity
android:name="com.abc.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and write android:exported="false" for service or broadcast receiver etc, like these:
<service android:name="com.startapp.sdk.adsbase.InfoEventService"
android:exported="false"/>
<service
android:name="com.startapp.sdk.adsbase.PeriodicJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"/>
<receiver android:name="com.startapp.sdk.adsbase.remoteconfig.BootCompleteListener"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
but if these services or broadcast receiver or used in the implemented library which mean it will be inside the manifest file of the library. so we will copy those service and broadcast receiver etc from those library manifest file and will paste in our main activity manifest, as like above i have copied the intent_fileter,services or broadcast receiver of the start.io sdk implented in my app to my main mainfest file.
How to copy merger manifest file to main manifest file
open your project's AndroidManifest.xml.
at the bottom of the window, click on the Merged Manifest tab.
look for any activity that includes an intent-filter tag and is missing the android:exported attribute
now copy all those to main manifest file.
Search by phrase "intent-filter" and then add " android:exported="false" to every top xml element
<receiver
android:name=".listener.SmsListener"
android:enabled="true"
android:exported="false"
>
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
My problem was that I didn't find all missing android:exported
I kept looking for missing android:exported="true|false". Added it everywhere I saw. Problem still persisted.
Solution
I had buildToolsVersion = "28.0.3" in gradle so the merge manifest error logs didn't help me at all.
So I upgraded to buildToolsVersion = "31.0.0" and the merge manifest showed me where the missing export was located.
Go to the AndroidManifest.xml Click Merged Manifest tab and Find the Keword in project
EG: Error: android:exported needs to be explicitly specified for element <activity#com.cpa.accountManagement.ui.authenticated.splash.SplashActivity>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. accountManagement.app main manifest (this file), line 52
Find the "SplashActivity" Tag and add android:exported="true"
For those who are still facing this error and did not find a solution...
add this is manifest file:
<service
android:name="org.jitsi.meet.sdk.ConnectionService"
android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.telecom.ConnectionService" />
</intent-filter>
</service>

This file cannot be installed on a device with Android version 12 or higher [duplicate]

After upgrading to android 12, the application is not compiling. It shows
"Manifest merger failed with multiple errors, see logs"
Error showing in Merged manifest:
Merging Errors:
Error: android:exported needs to be explicitly specified for . 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. main manifest (this file)
I have set all the activity with android:exported="false". But it is still showing this issue.
My manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.siacs.conversations">
<uses-sdk tools:overrideLibrary="net.ypresto.androidtranscoder" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<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" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<application
android:name=".Application"
android:allowBackup="false"
android:allowClearUserData="true"
android:appCategory="social"
android:hardwareAccelerated="true"
android:icon="#mipmap/ic_app_launch"
android:label="#string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="#xml/network_security_configuration"
android:requestLegacyExternalStorage="true"
android:roundIcon="#mipmap/ic_app_launch_round"
android:theme="#style/ConversationsTheme"
android:usesCleartextTraffic="true"
android:windowSoftInputMode="adjustPan|adjustResize"
tools:replace="android:label"
tools:targetApi="q">
<activity
android:name=".ui.search.GroupSearchActivity"
android:exported="true" />
<activity
android:name=".ui.profileUpdating.FavouritesActivity"
android:exported="true" />
<activity
android:name=".ui.profileUpdating.NameActivity"
android:exported="true" />
<activity
android:name=".ui.CompulsoryUpdateActivity"
android:exported="true" />
<activity android:name=".ui.payments.doPayment.DoPaymentActivity"
android:exported="true" />
<activity android:name=".ui.individualList.IndividualListActivity"
android:exported="true" />
<activity android:name=".ui.payments.setPayment.SetPaymentActivity"
android:exported="true" />
<activity android:name=".ui.login.otpActivity.OTPActivity"
android:exported="true" />
<activity android:name=".ui.login.loginActivity.LoginActivity"
android:exported="true" />
<service android:name=".services.XmppConnectionService" android:exported="true" />
<receiver android:name=".services.EventReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
<action android:name="android.media.RINGER_MODE_CHANGED" />
</intent-filter>
</receiver>
<activity
android:name=".ui.ShareLocationActivity"
android:label="#string/title_activity_share_location"
android:exported="true"/>
<activity
android:name=".ui.SearchActivity"
android:label="#string/search_messages"
android:exported="true" />
<activity
android:name=".ui.RecordingActivity"
android:configChanges="orientation|screenSize"
android:theme="#style/ConversationsTheme.Dialog"
android:exported="true" />
<activity
android:name=".ui.ShowLocationActivity"
android:label="#string/title_activity_show_location"
android:exported="true" />
<activity
android:name=".ui.SplashActivity"
android:theme="#style/SplashTheme"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.ConversationsActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:minWidth="300dp"
android:minHeight="300dp"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.ScanActivity"
android:screenOrientation="portrait"
android:exported="true"
android:theme="#style/ConversationsTheme.FullScreen"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".ui.UriHandlerActivity"
android:label="#string/app_name"
android:exported="true">
<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="xmpp" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="im.app.in" />
<data android:pathPrefix="/i/" />
<data android:pathPrefix="/j/" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="imto" />
<data android:host="jabber" />
</intent-filter>
</activity>
<activity
android:name=".ui.StartConversationActivity"
android:label="#string/title_activity_start_conversation"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".ui.SettingsActivity"
android:label="#string/title_activity_settings"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
</intent-filter>
</activity>
<activity
android:name=".ui.ChooseContactActivity"
android:label="#string/title_activity_choose_contact"
android:exported="true" />
<activity
android:name=".ui.BlocklistActivity"
android:label="#string/title_activity_block_list"
android:exported="true"/>
<activity
android:name=".ui.ChangePasswordActivity"
android:label="#string/change_password_on_server"
android:exported="true"/>
<activity
android:name=".ui.ChooseAccountForProfilePictureActivity"
android:enabled="false"
android:label="#string/choose_account"
android:exported="true">
<intent-filter android:label="#string/set_profile_picture">
<action android:name="android.intent.action.ATTACH_DATA" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity
android:name=".ui.ShareViaAccountActivity"
android:label="#string/title_activity_share_via_account"
android:launchMode="singleTop"
android:exported="true" />
<activity
android:name=".ui.EditAccountActivity"
android:launchMode="singleTop"
android:exported="true"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".ui.ConferenceDetailsActivity"
android:label="#string/action_muc_details"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.ContactDetailsActivity"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.PublishProfilePictureActivity"
android:label="#string/mgmt_account_publish_avatar"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.PublishGroupChatProfilePictureActivity"
android:exported="true"
android:label="#string/group_chat_avatar" />
<activity
android:name=".ui.ShareWithActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<!-- the value here needs to be the full class name; independent of the configured applicationId -->
<meta-data
android:name="android.service.chooser.chooser_target_service"
android:value="eu.siacs.conversations.services.ContactChooserTargetService" />
</activity>
<activity
android:name=".ui.TrustKeysActivity"
android:label="#string/trust_omemo_fingerprints"
android:exported="true"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:exported="true"
android:theme="#style/Base.Theme.AppCompat" />
<activity android:name=".ui.MemorizingActivity"
android:exported="true" />
<activity
android:name=".ui.MediaBrowserActivity"
android:exported="true"
android:label="#string/media_browser" />
<service android:name=".services.ExportBackupService" android:exported="true"/>
<service android:name=".services.ImportBackupService" android:exported="true"/>
<service
android:name=".services.ContactChooserTargetService"
android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.service.chooser.ChooserTargetService" />
</intent-filter>
</service>
<service android:name=".services.CompulsoryUpdateService" android:exported="true"/>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.files"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
<provider
android:name=".services.BarcodeProvider"
android:authorities="${applicationId}.barcodes"
android:exported="false"
android:grantUriPermissions="true" />
<activity
android:name=".ui.ShortcutActivity"
android:label="#string/contact"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
</intent-filter>
</activity>
<activity
android:name=".ui.MucUsersActivity"
android:exported="true"
android:label="#string/group_chat_members" />
<activity
android:name=".ui.ChannelDiscoveryActivity"
android:exported="true"
android:label="#string/discover_channels" />
<activity
android:name=".ui.RtpSessionActivity"
android:autoRemoveFromRecents="true"
android:exported="true"
android:launchMode="singleInstance"
android:supportsPictureInPicture="true" />
</application>
</manifest>
My second manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.siacs.conversations">
<application tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".ui.ManageAccountActivity"
android:label="#string/title_activity_manage_accounts"
android:launchMode="singleTask"
android:exported="true"/>
<activity
android:name=".ui.MagicCreateActivity"
android:label="#string/create_new_account"
android:launchMode="singleTask"
android:exported="true"/>
<activity
android:name=".ui.EasyOnboardingInviteActivity"
android:label="#string/invite_to_app"
android:launchMode="singleTask" />
<activity
android:name=".ui.ImportBackupActivity"
android:label="#string/restore_backup"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.conversations.backup" />
<data android:scheme="content" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.conversations.backup" />
<data android:scheme="file" />
</intent-filter>
<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="content" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.ceb" />
<data android:pathPattern=".*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
</intent-filter>
<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="file" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.ceb" />
<data android:pathPattern=".*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
</intent-filter>
</activity>
</application>
</manifest>
My gradle file:
import com.android.build.OutputFile
// Top-level build file where you can add configuration options common to all
// sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.21"
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
configurations {
conversationsFreeCompatImplementation
}
dependencies {
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.sufficientlysecure:openpgp-api:10.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.exifinterface:exifinterface:1.3.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.emoji:emoji:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
conversationsFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0'
implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
//zxing stopped supporting Java 7 so we have to stick with 3.3.3
//https://github.com/zxing/zxing/issues/1170
implementation 'com.google.zxing:core:3.4.1'
implementation 'de.measite.minidns:minidns-hla:0.2.4'
implementation 'me.leolin:ShortcutBadger:1.1.22#aar'
implementation 'org.whispersystems:signal-protocol-java:2.8.1'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation "com.wefika:flowlayout:0.4.1"
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.3.0'
implementation 'org.jxmpp:jxmpp-jid:1.0.1'
implementation 'org.osmdroid:osmdroid-android:6.1.10'
implementation 'org.hsluv:hsluv:0.2'
implementation 'org.conscrypt:conscrypt-android:2.5.2'
implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation "com.leinardi.android:speed-dial:3.2.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.2"
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'com.google.guava:guava:30.1.1-android'
implementation 'org.webrtc:google-webrtc:1.0.32006'
// Lifecycle Helper
implementation "androidx.activity:activity-ktx:1.3.0-rc02"
implementation "androidx.fragment:fragment-ktx:1.3.6"
//Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
//CardView
implementation "androidx.cardview:cardview:1.0.0"
//Country Code Picker
implementation 'com.hbb20:ccp:2.5.3'
//Firebase
implementation 'com.google.firebase:firebase-bom:28.3.0'
implementation 'com.google.firebase:firebase-auth-ktx:21.0.1'
implementation 'androidx.browser:browser:1.3.0'
//OTP view
implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.2'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//Gson
implementation 'com.google.code.gson:gson:2.8.7'
//Multidex
implementation 'androidx.multidex:multidex:2.0.1'
//Round Image
implementation 'de.hdodenhof:circleimageview:3.1.0'
// Button with image and text
implementation 'com.github.Omega-R:OmegaCenterIconButton:0.0.4#aar'
//Razor pay
implementation 'com.razorpay:checkout:1.6.10'
//Mixpanel Tracking
implementation 'com.mixpanel.android:mixpanel-android:5.9.1'
//Loading screen
implementation 'com.wang.avi:library:2.1.3'
//Loading
implementation 'com.wang.avi:library:2.1.3'
//Form
implementation 'com.quickbirdstudios:surveykit:1.1.0'
}
ext {
travisBuild = System.getenv("TRAVIS") == "true"
preDexEnabled = System.getProperty("pre-dex", "true")
abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
}
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 24
targetSdkVersion 31
versionCode 44
versionName "2.0.4"
multiDexEnabled = true
archivesBaseName += "-$versionName"
applicationId "com.app.app"
resValue "string", "applicationId", applicationId
def appName = "app"
resValue "string", "app_name", appName
buildConfigField "String", "APP_NAME", "\"$appName\""
}
splits {
abi {
universalApk true
enable true
}
}
configurations {
compile.exclude group: 'org.jetbrains' , module:'annotations'
}
dataBinding {
enabled true
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
jumboMode true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions("mode", "distribution", "emoji")
productFlavors {
conversations {
dimension "mode"
}
free {
dimension "distribution"
versionNameSuffix "+f"
}
compat {
dimension "emoji"
versionNameSuffix "c"
}
}
sourceSets {
conversationsFreeCompat {
java {
srcDir 'src/freeCompat/java'
srcDir 'src/conversationsFree/java'
}
}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
versionNameSuffix "r"
}
debug {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
versionNameSuffix "d"
}
}
if (new File("signing.properties").exists()) {
Properties props = new Properties()
props.load(new FileInputStream(file("signing.properties")))
signingConfigs {
release {
storeFile file(props['keystore'])
storePassword props['keystore.password']
keyAlias props['keystore.alias']
keyPassword props['keystore.password']
}
}
buildTypes.release.signingConfig = signingConfigs.release
}
lintOptions {
disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
}
subprojects {
afterEvaluate {
if (getPlugins().hasPlugin('android') ||
getPlugins().hasPlugin('android-library')) {
configure(android.lintOptions) {
disable 'AndroidGradlePluginVersion', 'MissingTranslation'
}
}
}
}
packagingOptions {
exclude 'META-INF/BCKEY.DSA'
exclude 'META-INF/BCKEY.SF'
}
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
if (baseAbiVersionCode != null) {
output.versionCodeOverride = (100 * variant.versionCode) + baseAbiVersionCode
}
}
}
}
I had this issue and one of the libraries I used wasn't setting it correctly.
Find location
First of all, we need to find the exact location and/or cause for the error,
which can be done with different approaches (see below).
Find by inspecting merged-manifest (approach #1)
You can find it by doing the steps:
Set target SDK to 30 (to silence 31+ errors).
Open application's manifest (AndroidManifest.xml) and click on "Merged Manifest" tab on bottom of your edit pane:
Which if you configure build.gradle like:
allprojects {
buildDir = "${rootProject.rootDir}/build/${project.name}"
}
Something similar should be in a sub-path like:
build/my-app/intermediates/merged_manifest/debug/AndroidManifest.xml
Go to the individual manifest file of all the libraries (You can skip this step if the merged manifest is created and you can just look into the merged manifest)
Search if there's any entry of type activity, service, receiver, or provider which does not have an exported attribute, and for each entry follow below "Fix found entries" section (or see once for how to set exported attribute).
Set target SDK back to 31 (or whatever it was before changing to 30).
Find by console logs (approach #2)
In Git-bash run something like:
./gradlew assembleDebug --stacktrace --info | tee my-logs.txt
Open my-logs.txt file (which previous step created, in your preferred text-editor).
Now, the exact location is hidden in the logs,
hence search in the created my-logs.txt file,
for these keywords:
activity#
service#
receiver#
provider#
Which should find something like:
activity#androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity
ADDED from [androidx.test:core:1.2.0] C:\Users\Admin\.gradle\caches\transforms-3\709730c74fe4dc9f8fd991eb4d1c2adc\transformed\jetified-core-1.2.0\AndroidManifest.xml:27:9-33:20
Open AndroidManifest.xml file that previous steps did find, search if there's any entry of type activity, service, receiver, or provider which does not have an exported attribute, and see below "Fix found entries" section (for how to set each entries exported attribute).
Note that (at time of writting) passing --stacktrace alone did not include location info ;-)
Fix found entries
If the real (not build-generated) source of found entry is in root-project's manifest (or somewhere you can alter),
set exported attribute to corresponding need (which is normally false) therein directly, like:
<receiver
android:name="<name_of_the_entry>"
android:exported="false or true"
tools:node="merge" />
Note that both android:exported="..." and tools:node="merge" are set above.
But if found entry's specification is written in the manifest of a third-party library (which's real-source you can't alter),
override the specification of said library by adding it to our root-project's manifest, for example like:
<provider
android:name="com.squareup.picasso.PicassoProvider"
android:exported="false"
tools:node="merge"
tools:overrideLibrary="com.squareup.picasso.picasso" />
Note that this time tools:overrideLibrary="..." is set as well.
For more information see Documentation,
and/or Similar issue in a SDK.
Fixing such issue can be a bit cumbersome, cause the IDE doesn't provide details on the error, it just tells you that there is an Activity, Receiver or Service without the exported parameter, but does not tell you which one it is. As Jakos recommend, you can manually check the merged manifest, or use this script in case the generated manifest is too large.
After that you can modify the affected entries by adding the exported attribute if it is part of your project, or override it if it's part of a library with:
<activity android:name="name_of_the_activity_inside_library>"
android:exported="false|true"
tools:node="merge" />
UPDATE:
The manifest merge task seems to fail without generating the manifest when targeting android S and this problems are detected, so my advise is to compile the app using a targetSdk lower than 31, and then inspect the generated manifest either manually or using the script I linked. (you can find the merged manifest on the build folder or by inspecting the generated apk)
Change targetSdkVersion back to 30
You can leave compileSdkVersion at 31
Then hit Run
For instrumented test, if you are using compose test, make sure you add androidx.test.ext:junit in addition to compose.ui dependencies
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.4"
After the build has failed go to AndroidManifest.xml and in the bottom click merged manifest see which activities which have intent-filter but don't have exported=true attribute.
Or you can just get the activities which are giving error.
Add these activities to your App manifest with android:exported="true" and app tools:node="merge" this will add exported attribute to the activities giving error.
Example:
<activity
android:name="<activity which is giving error>"
android:exported="true"
tools:node="merge" />
You will have to do this once, you can remove this once the library developers update their libs.
Check your build.gradle file for:
debugImplementation "androidx.fragment:fragment-testing:<version>"
and if present change it to:
androidTestImplementation "androidx.fragment:fragment-testing:<version>"
It should always have been androidTestImplementation but there was some dependency issue before and it was necessary to use debugImplementation as a workaround. The IDE actually prompted you to do this. But evidently it is fixed for SDK 31, and if you leave it as debugImplementation you get the android:exported-missing manifest error which comes from a manifest.xml in a dependent package.
as the target sdk update to 31 android 12 so for that you have to do android export in your activity luncher in manifest.xml
android:exported="true"
The problem in my case was the test:core:1.3.0 (see screen shot).
I had to override the manifest entries for this library and declare the android:exported property:
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="true"
tools:node="merge"/>
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="true"
tools:node="merge"/>
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="true"
tools:node="merge"/>
<activity
android:name=".MainActivity"
android:exported="true" <** add this line on AndroidManifest.xml**
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
</activity>
I'm not sure what you're using to code, but in order to set it in Android Studio, open the manifest of your project and under the "activity" section, put android:exported="true"(or false if that is what you prefer). I have attached an example.
I happen to know that issue in the android 12 specifically. There is already a bug raised in Android SDK. In the solution of your problem here is a file you can add in android studio and run the method.
Enable android exported file
Then run the def methods and try to build.
It is tried and tested working method.
If your app targets Android 12 or higher, you must declare these attribution tags in your app's manifest file.
If the app component includes the LAUNCHER category, set android:exported to true.
<activity
android:name="com.test.activity.SplashActivity"
android:clearTaskOnLaunch="true"
android:label="#string/app_name"
android:launchMode="singleTop"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:exported="true">
Also check receiver or service in Androidmanifest, if you are using any receiver or service set android:exported="true" or false according requirement.
<receiver
android:name="com.test.receiver.ShareReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.test.fcm.android.action.broadcast" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.tagmanager.InstallReferrerService"
android:exported="true" />
Also update all your gradle dependency.
I have updated following dependency as per requirement.
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
Hope it will help you as well.
if you are using flutter , upgrading flutter_local_notifications to the latest version (now is 9.3.2) may solve this error..
If you sure about adding exported to every element in manifest file and still got this error, simply :
switch to project directory and open merged manifest file in app\build\intermediates\merged_manifest
search for any component that contains intent-filter and didn't have exported attribute
override this component in your manifest file by copy past it to your main manifest file
tip: if you can't find merged file because it's already failed to generate it .temporary downgrade to targetSdkVersion 30 and compileSdkVersion 30 and build project to generate this file and then follow above steps and then upgrade to 31 (android 12)
This is the most common issue after upgrading your TargetSDK 32 or Android Studio with API Android 12 support.
To relate this was my error:
The errors were:
Error:
android:exported needs to be explicitly specified for element <receiver#com.onesignal.BootUpReceiver>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
D:\iptvapp\iptvapp\app\src\main\AndroidManifest.xml:99:9-103:20 Error:
android:exported needs to be explicitly specified for element <receiver#com.onesignal.UpgradeReceiver>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
Then by using the merged Mainfest Clikc on the Libirary that has error for instacne
onesingal.
Then copy the error if its the receiver part and add it to your main manifest file as follows with
android:exported
set to true on.
and them
<receiver android:name="com.onesignal.BootUpReceiver" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<receiver android:name="com.onesignal.UpgradeReceiver" android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
worked like a charm!
Found this solution here, works for me. This is given by official razorpay github. They've mentioned they'll fix it in next release.
<receiver
android:name="com.razorpay.RzpTokenReceiver"
android:exported="false">
<intent-filter>
<action android:name="rzp.device_token.share" />
</intent-filter>
</receiver>
<activity
android:name="com.razorpay.CheckoutActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:exported="true"
android:theme="#style/CheckoutTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data
android:host="rzp.io"
android:scheme="io.rzp" />
</intent-filter>
</activity>
Case 1: No submodules or libraries
This issue started with SDK 31. If you don't have any libraries or submodules add
android:exported="true" <!-- or false as required -->
You can right click on the tag and Android Studio will suggest you.
Case 2: With submodules or libraries
If you have other libraries or modules that you are importing, you have to override them too. For that see the tab 'Merged Manifest'.
OR You can open
<ProjectRoot>/app/build/intermediates/merged_manifest/<your
flavor>/AndroidManifest.xml
in an editor. I prefer the second method as Merged manifest doesn't allow to search from Android Studio.
Copy <activity>, <receiver> or any others causing build errors.
Paste them to Main Manifest
Add android:exported="true" or android:exported="false" as required
Rebuild
Case 3: If None of the above works
If none of the above works, you will have to wait until your library provider makes necessary changes. Until they make changes, you may revert SDK version to 30 or lower. Lowering sdk should fix the issue temporarily.
My problem was that we were using older hilt version 2.38.1:
"com.google.dagger:hilt-android:2.38.1"
"com.google.dagger:hilt-android-gradle-plugin:2.38.1"
"com.google.dagger:hilt-android-compiler:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1" under the hood depends on core testing library 1.3.0, which does set exported properties.
To fix this, make sure you are using latest dagger hilt version (2.40.5 works):
"com.google.dagger:hilt-android:2.40.5"
"com.google.dagger:hilt-android-gradle-plugin:2.40.5"
"com.google.dagger:hilt-android-compiler:2.40.5"
"com.google.dagger:hilt-android-testing:2.40.5"
In my case I update fragment-testing to 1.5.3 version and this helped me:
dependencies {
debugImplementation androidx.fragment:fragment-testing:1.5.3
}
Just add these in build.gradle...
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.3.3"
Works like charm!
I was getting this error thrown what targeting sdk 31 and found that the solution was in my build.gradle file. I was using implementation on my compose test dependency instead of testImplementation.
Seems unrelated I know but when you look at your merge manifest with a misused test dependency you will see tags added for InstrumentedActivity which will be missing the exported=true field.
Quoting official docs about this behavior change in android 12, you should look for activities containing intent-filter and those are the ones that need to be updated by setting explicitly the value of android:exported.
Build logs should point exactly to the activity with undeclared exported flag that stopped your build. You should see something like this between the last lines of the console's output of install gradle's commands:
> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/xxxxx.tmp/base.apk (at Binary XML file line #129): YOUR.FULLY.QUALIFIED.NAME.FAILING.ACTIVITY: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present
YOUR.FULLY.QUALIFIED.NAME.FAILING.ACTIVITY should point you to the specific activity that is blocking your build.
Here is also the link to the implications of setting android:exported.
For people with problems still using Flutter, in addition to putting exported=true in the application's <activity, you need to put it in the <activity of the installed plugins.
As I use the simpleauthflutter package, it generates an activity in androidmanifest and I put exported=true. That's the only way to work.
It will look like this:
Add
tools:node="merge"
to
<activity...
and upgrade
androidx.core.test
to latest version.
Will work like a charm :)
Copy and paste the gradle script above the root build.gradle file
Gradle Script for Android 12 Required Merge
And execute the task
doAddAndroidExportedIfNecessary
(for Add Automatically the tag required to missing activity - service - receiver )
doAddAndroidExportedForDependencies
(for Add Automatically the tag required to Dependencies missing activity - service - receiver )
Hope this script can resolved your problem
This error occur when we make the targetSkdVersion=31 for latest version 12, and the error cause if we have not use android:exported="true" in the launcher activity and android:exported="false" in other intent_filter,service or broadcast receiver.
We should write android:exported="true" only for launcher activity like this:
<activity
android:name="com.abc.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and write android:exported="false" for service or broadcast receiver etc, like these:
<service android:name="com.startapp.sdk.adsbase.InfoEventService"
android:exported="false"/>
<service
android:name="com.startapp.sdk.adsbase.PeriodicJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"/>
<receiver android:name="com.startapp.sdk.adsbase.remoteconfig.BootCompleteListener"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
but if these services or broadcast receiver or used in the implemented library which mean it will be inside the manifest file of the library. so we will copy those service and broadcast receiver etc from those library manifest file and will paste in our main activity manifest, as like above i have copied the intent_fileter,services or broadcast receiver of the start.io sdk implented in my app to my main mainfest file.
How to copy merger manifest file to main manifest file
open your project's AndroidManifest.xml.
at the bottom of the window, click on the Merged Manifest tab.
look for any activity that includes an intent-filter tag and is missing the android:exported attribute
now copy all those to main manifest file.
Search by phrase "intent-filter" and then add " android:exported="false" to every top xml element
<receiver
android:name=".listener.SmsListener"
android:enabled="true"
android:exported="false"
>
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
My problem was that I didn't find all missing android:exported
I kept looking for missing android:exported="true|false". Added it everywhere I saw. Problem still persisted.
Solution
I had buildToolsVersion = "28.0.3" in gradle so the merge manifest error logs didn't help me at all.
So I upgraded to buildToolsVersion = "31.0.0" and the merge manifest showed me where the missing export was located.
Go to the AndroidManifest.xml Click Merged Manifest tab and Find the Keword in project
EG: Error: android:exported needs to be explicitly specified for element <activity#com.cpa.accountManagement.ui.authenticated.splash.SplashActivity>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. accountManagement.app main manifest (this file), line 52
Find the "SplashActivity" Tag and add android:exported="true"
For those who are still facing this error and did not find a solution...
add this is manifest file:
<service
android:name="org.jitsi.meet.sdk.ConnectionService"
android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.telecom.ConnectionService" />
</intent-filter>
</service>

Error: Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` [duplicate]

After upgrading to android 12, the application is not compiling. It shows
"Manifest merger failed with multiple errors, see logs"
Error showing in Merged manifest:
Merging Errors:
Error: android:exported needs to be explicitly specified for . 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. main manifest (this file)
I have set all the activity with android:exported="false". But it is still showing this issue.
My manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.siacs.conversations">
<uses-sdk tools:overrideLibrary="net.ypresto.androidtranscoder" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission
android:name="android.permission.READ_PHONE_STATE"
android:maxSdkVersion="22" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<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" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.autofocus"
android:required="false" />
<uses-feature
android:name="android.hardware.microphone"
android:required="false" />
<application
android:name=".Application"
android:allowBackup="false"
android:allowClearUserData="true"
android:appCategory="social"
android:hardwareAccelerated="true"
android:icon="#mipmap/ic_app_launch"
android:label="#string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="#xml/network_security_configuration"
android:requestLegacyExternalStorage="true"
android:roundIcon="#mipmap/ic_app_launch_round"
android:theme="#style/ConversationsTheme"
android:usesCleartextTraffic="true"
android:windowSoftInputMode="adjustPan|adjustResize"
tools:replace="android:label"
tools:targetApi="q">
<activity
android:name=".ui.search.GroupSearchActivity"
android:exported="true" />
<activity
android:name=".ui.profileUpdating.FavouritesActivity"
android:exported="true" />
<activity
android:name=".ui.profileUpdating.NameActivity"
android:exported="true" />
<activity
android:name=".ui.CompulsoryUpdateActivity"
android:exported="true" />
<activity android:name=".ui.payments.doPayment.DoPaymentActivity"
android:exported="true" />
<activity android:name=".ui.individualList.IndividualListActivity"
android:exported="true" />
<activity android:name=".ui.payments.setPayment.SetPaymentActivity"
android:exported="true" />
<activity android:name=".ui.login.otpActivity.OTPActivity"
android:exported="true" />
<activity android:name=".ui.login.loginActivity.LoginActivity"
android:exported="true" />
<service android:name=".services.XmppConnectionService" android:exported="true" />
<receiver android:name=".services.EventReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.intent.action.ACTION_SHUTDOWN" />
<action android:name="android.media.RINGER_MODE_CHANGED" />
</intent-filter>
</receiver>
<activity
android:name=".ui.ShareLocationActivity"
android:label="#string/title_activity_share_location"
android:exported="true"/>
<activity
android:name=".ui.SearchActivity"
android:label="#string/search_messages"
android:exported="true" />
<activity
android:name=".ui.RecordingActivity"
android:configChanges="orientation|screenSize"
android:theme="#style/ConversationsTheme.Dialog"
android:exported="true" />
<activity
android:name=".ui.ShowLocationActivity"
android:label="#string/title_activity_show_location"
android:exported="true" />
<activity
android:name=".ui.SplashActivity"
android:theme="#style/SplashTheme"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.ConversationsActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:minWidth="300dp"
android:minHeight="300dp"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.ScanActivity"
android:screenOrientation="portrait"
android:exported="true"
android:theme="#style/ConversationsTheme.FullScreen"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name=".ui.UriHandlerActivity"
android:label="#string/app_name"
android:exported="true">
<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="xmpp" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="im.app.in" />
<data android:pathPrefix="/i/" />
<data android:pathPrefix="/j/" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="imto" />
<data android:host="jabber" />
</intent-filter>
</activity>
<activity
android:name=".ui.StartConversationActivity"
android:label="#string/title_activity_start_conversation"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".ui.SettingsActivity"
android:label="#string/title_activity_settings"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
</intent-filter>
</activity>
<activity
android:name=".ui.ChooseContactActivity"
android:label="#string/title_activity_choose_contact"
android:exported="true" />
<activity
android:name=".ui.BlocklistActivity"
android:label="#string/title_activity_block_list"
android:exported="true"/>
<activity
android:name=".ui.ChangePasswordActivity"
android:label="#string/change_password_on_server"
android:exported="true"/>
<activity
android:name=".ui.ChooseAccountForProfilePictureActivity"
android:enabled="false"
android:label="#string/choose_account"
android:exported="true">
<intent-filter android:label="#string/set_profile_picture">
<action android:name="android.intent.action.ATTACH_DATA" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<activity
android:name=".ui.ShareViaAccountActivity"
android:label="#string/title_activity_share_via_account"
android:launchMode="singleTop"
android:exported="true" />
<activity
android:name=".ui.EditAccountActivity"
android:launchMode="singleTop"
android:exported="true"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name=".ui.ConferenceDetailsActivity"
android:label="#string/action_muc_details"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.ContactDetailsActivity"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.PublishProfilePictureActivity"
android:label="#string/mgmt_account_publish_avatar"
android:exported="true"
android:windowSoftInputMode="stateHidden" />
<activity
android:name=".ui.PublishGroupChatProfilePictureActivity"
android:exported="true"
android:label="#string/group_chat_avatar" />
<activity
android:name=".ui.ShareWithActivity"
android:label="#string/app_name"
android:launchMode="singleTop"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<!-- the value here needs to be the full class name; independent of the configured applicationId -->
<meta-data
android:name="android.service.chooser.chooser_target_service"
android:value="eu.siacs.conversations.services.ContactChooserTargetService" />
</activity>
<activity
android:name=".ui.TrustKeysActivity"
android:label="#string/trust_omemo_fingerprints"
android:exported="true"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:exported="true"
android:theme="#style/Base.Theme.AppCompat" />
<activity android:name=".ui.MemorizingActivity"
android:exported="true" />
<activity
android:name=".ui.MediaBrowserActivity"
android:exported="true"
android:label="#string/media_browser" />
<service android:name=".services.ExportBackupService" android:exported="true"/>
<service android:name=".services.ImportBackupService" android:exported="true"/>
<service
android:name=".services.ContactChooserTargetService"
android:permission="android.permission.BIND_CHOOSER_TARGET_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.service.chooser.ChooserTargetService" />
</intent-filter>
</service>
<service android:name=".services.CompulsoryUpdateService" android:exported="true"/>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.files"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_paths" />
</provider>
<provider
android:name=".services.BarcodeProvider"
android:authorities="${applicationId}.barcodes"
android:exported="false"
android:grantUriPermissions="true" />
<activity
android:name=".ui.ShortcutActivity"
android:label="#string/contact"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
</intent-filter>
</activity>
<activity
android:name=".ui.MucUsersActivity"
android:exported="true"
android:label="#string/group_chat_members" />
<activity
android:name=".ui.ChannelDiscoveryActivity"
android:exported="true"
android:label="#string/discover_channels" />
<activity
android:name=".ui.RtpSessionActivity"
android:autoRemoveFromRecents="true"
android:exported="true"
android:launchMode="singleInstance"
android:supportsPictureInPicture="true" />
</application>
</manifest>
My second manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="eu.siacs.conversations">
<application tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".ui.ManageAccountActivity"
android:label="#string/title_activity_manage_accounts"
android:launchMode="singleTask"
android:exported="true"/>
<activity
android:name=".ui.MagicCreateActivity"
android:label="#string/create_new_account"
android:launchMode="singleTask"
android:exported="true"/>
<activity
android:name=".ui.EasyOnboardingInviteActivity"
android:label="#string/invite_to_app"
android:launchMode="singleTask" />
<activity
android:name=".ui.ImportBackupActivity"
android:label="#string/restore_backup"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.conversations.backup" />
<data android:scheme="content" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.conversations.backup" />
<data android:scheme="file" />
</intent-filter>
<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="content" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.ceb" />
<data android:pathPattern=".*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
</intent-filter>
<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="file" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.ceb" />
<data android:pathPattern=".*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\..*\\..*\\.ceb" />
</intent-filter>
</activity>
</application>
</manifest>
My gradle file:
import com.android.build.OutputFile
// Top-level build file where you can add configuration options common to all
// sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.21"
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
gradlePluginPortal()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.8'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
configurations {
conversationsFreeCompatImplementation
}
dependencies {
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'org.sufficientlysecure:openpgp-api:10.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.exifinterface:exifinterface:1.3.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.emoji:emoji:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
conversationsFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0'
implementation 'org.bouncycastle:bcmail-jdk15on:1.64'
//zxing stopped supporting Java 7 so we have to stick with 3.3.3
//https://github.com/zxing/zxing/issues/1170
implementation 'com.google.zxing:core:3.4.1'
implementation 'de.measite.minidns:minidns-hla:0.2.4'
implementation 'me.leolin:ShortcutBadger:1.1.22#aar'
implementation 'org.whispersystems:signal-protocol-java:2.8.1'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation "com.wefika:flowlayout:0.4.1"
implementation 'net.ypresto.androidtranscoder:android-transcoder:0.3.0'
implementation 'org.jxmpp:jxmpp-jid:1.0.1'
implementation 'org.osmdroid:osmdroid-android:6.1.10'
implementation 'org.hsluv:hsluv:0.2'
implementation 'org.conscrypt:conscrypt-android:2.5.2'
implementation 'me.drakeet.support:toastcompat:1.1.0'
implementation "com.leinardi.android:speed-dial:3.2.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.2"
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'
implementation 'com.google.guava:guava:30.1.1-android'
implementation 'org.webrtc:google-webrtc:1.0.32006'
// Lifecycle Helper
implementation "androidx.activity:activity-ktx:1.3.0-rc02"
implementation "androidx.fragment:fragment-ktx:1.3.6"
//Navigation
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
//CardView
implementation "androidx.cardview:cardview:1.0.0"
//Country Code Picker
implementation 'com.hbb20:ccp:2.5.3'
//Firebase
implementation 'com.google.firebase:firebase-bom:28.3.0'
implementation 'com.google.firebase:firebase-auth-ktx:21.0.1'
implementation 'androidx.browser:browser:1.3.0'
//OTP view
implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.1.2'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//Gson
implementation 'com.google.code.gson:gson:2.8.7'
//Multidex
implementation 'androidx.multidex:multidex:2.0.1'
//Round Image
implementation 'de.hdodenhof:circleimageview:3.1.0'
// Button with image and text
implementation 'com.github.Omega-R:OmegaCenterIconButton:0.0.4#aar'
//Razor pay
implementation 'com.razorpay:checkout:1.6.10'
//Mixpanel Tracking
implementation 'com.mixpanel.android:mixpanel-android:5.9.1'
//Loading screen
implementation 'com.wang.avi:library:2.1.3'
//Loading
implementation 'com.wang.avi:library:2.1.3'
//Form
implementation 'com.quickbirdstudios:surveykit:1.1.0'
}
ext {
travisBuild = System.getenv("TRAVIS") == "true"
preDexEnabled = System.getProperty("pre-dex", "true")
abiCodes = ['armeabi-v7a': 1, 'x86': 2, 'x86_64': 3, 'arm64-v8a': 4]
}
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 24
targetSdkVersion 31
versionCode 44
versionName "2.0.4"
multiDexEnabled = true
archivesBaseName += "-$versionName"
applicationId "com.app.app"
resValue "string", "applicationId", applicationId
def appName = "app"
resValue "string", "app_name", appName
buildConfigField "String", "APP_NAME", "\"$appName\""
}
splits {
abi {
universalApk true
enable true
}
}
configurations {
compile.exclude group: 'org.jetbrains' , module:'annotations'
}
dataBinding {
enabled true
}
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
jumboMode true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions("mode", "distribution", "emoji")
productFlavors {
conversations {
dimension "mode"
}
free {
dimension "distribution"
versionNameSuffix "+f"
}
compat {
dimension "emoji"
versionNameSuffix "c"
}
}
sourceSets {
conversationsFreeCompat {
java {
srcDir 'src/freeCompat/java'
srcDir 'src/conversationsFree/java'
}
}
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
versionNameSuffix "r"
}
debug {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
versionNameSuffix "d"
}
}
if (new File("signing.properties").exists()) {
Properties props = new Properties()
props.load(new FileInputStream(file("signing.properties")))
signingConfigs {
release {
storeFile file(props['keystore'])
storePassword props['keystore.password']
keyAlias props['keystore.alias']
keyPassword props['keystore.password']
}
}
buildTypes.release.signingConfig = signingConfigs.release
}
lintOptions {
disable 'MissingTranslation', 'InvalidPackage','AppCompatResource'
}
subprojects {
afterEvaluate {
if (getPlugins().hasPlugin('android') ||
getPlugins().hasPlugin('android-library')) {
configure(android.lintOptions) {
disable 'AndroidGradlePluginVersion', 'MissingTranslation'
}
}
}
}
packagingOptions {
exclude 'META-INF/BCKEY.DSA'
exclude 'META-INF/BCKEY.SF'
}
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI))
if (baseAbiVersionCode != null) {
output.versionCodeOverride = (100 * variant.versionCode) + baseAbiVersionCode
}
}
}
}
I had this issue and one of the libraries I used wasn't setting it correctly.
Find location
First of all, we need to find the exact location and/or cause for the error,
which can be done with different approaches (see below).
Find by inspecting merged-manifest (approach #1)
You can find it by doing the steps:
Set target SDK to 30 (to silence 31+ errors).
Open application's manifest (AndroidManifest.xml) and click on "Merged Manifest" tab on bottom of your edit pane:
Which if you configure build.gradle like:
allprojects {
buildDir = "${rootProject.rootDir}/build/${project.name}"
}
Something similar should be in a sub-path like:
build/my-app/intermediates/merged_manifest/debug/AndroidManifest.xml
Go to the individual manifest file of all the libraries (You can skip this step if the merged manifest is created and you can just look into the merged manifest)
Search if there's any entry of type activity, service, receiver, or provider which does not have an exported attribute, and for each entry follow below "Fix found entries" section (or see once for how to set exported attribute).
Set target SDK back to 31 (or whatever it was before changing to 30).
Find by console logs (approach #2)
In Git-bash run something like:
./gradlew assembleDebug --stacktrace --info | tee my-logs.txt
Open my-logs.txt file (which previous step created, in your preferred text-editor).
Now, the exact location is hidden in the logs,
hence search in the created my-logs.txt file,
for these keywords:
activity#
service#
receiver#
provider#
Which should find something like:
activity#androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity
ADDED from [androidx.test:core:1.2.0] C:\Users\Admin\.gradle\caches\transforms-3\709730c74fe4dc9f8fd991eb4d1c2adc\transformed\jetified-core-1.2.0\AndroidManifest.xml:27:9-33:20
Open AndroidManifest.xml file that previous steps did find, search if there's any entry of type activity, service, receiver, or provider which does not have an exported attribute, and see below "Fix found entries" section (for how to set each entries exported attribute).
Note that (at time of writting) passing --stacktrace alone did not include location info ;-)
Fix found entries
If the real (not build-generated) source of found entry is in root-project's manifest (or somewhere you can alter),
set exported attribute to corresponding need (which is normally false) therein directly, like:
<receiver
android:name="<name_of_the_entry>"
android:exported="false or true"
tools:node="merge" />
Note that both android:exported="..." and tools:node="merge" are set above.
But if found entry's specification is written in the manifest of a third-party library (which's real-source you can't alter),
override the specification of said library by adding it to our root-project's manifest, for example like:
<provider
android:name="com.squareup.picasso.PicassoProvider"
android:exported="false"
tools:node="merge"
tools:overrideLibrary="com.squareup.picasso.picasso" />
Note that this time tools:overrideLibrary="..." is set as well.
For more information see Documentation,
and/or Similar issue in a SDK.
Fixing such issue can be a bit cumbersome, cause the IDE doesn't provide details on the error, it just tells you that there is an Activity, Receiver or Service without the exported parameter, but does not tell you which one it is. As Jakos recommend, you can manually check the merged manifest, or use this script in case the generated manifest is too large.
After that you can modify the affected entries by adding the exported attribute if it is part of your project, or override it if it's part of a library with:
<activity android:name="name_of_the_activity_inside_library>"
android:exported="false|true"
tools:node="merge" />
UPDATE:
The manifest merge task seems to fail without generating the manifest when targeting android S and this problems are detected, so my advise is to compile the app using a targetSdk lower than 31, and then inspect the generated manifest either manually or using the script I linked. (you can find the merged manifest on the build folder or by inspecting the generated apk)
Change targetSdkVersion back to 30
You can leave compileSdkVersion at 31
Then hit Run
For instrumented test, if you are using compose test, make sure you add androidx.test.ext:junit in addition to compose.ui dependencies
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.0.4"
After the build has failed go to AndroidManifest.xml and in the bottom click merged manifest see which activities which have intent-filter but don't have exported=true attribute.
Or you can just get the activities which are giving error.
Add these activities to your App manifest with android:exported="true" and app tools:node="merge" this will add exported attribute to the activities giving error.
Example:
<activity
android:name="<activity which is giving error>"
android:exported="true"
tools:node="merge" />
You will have to do this once, you can remove this once the library developers update their libs.
Check your build.gradle file for:
debugImplementation "androidx.fragment:fragment-testing:<version>"
and if present change it to:
androidTestImplementation "androidx.fragment:fragment-testing:<version>"
It should always have been androidTestImplementation but there was some dependency issue before and it was necessary to use debugImplementation as a workaround. The IDE actually prompted you to do this. But evidently it is fixed for SDK 31, and if you leave it as debugImplementation you get the android:exported-missing manifest error which comes from a manifest.xml in a dependent package.
as the target sdk update to 31 android 12 so for that you have to do android export in your activity luncher in manifest.xml
android:exported="true"
The problem in my case was the test:core:1.3.0 (see screen shot).
I had to override the manifest entries for this library and declare the android:exported property:
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
android:exported="true"
tools:node="merge"/>
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyActivity"
android:exported="true"
tools:node="merge"/>
<activity android:name="androidx.test.core.app.InstrumentationActivityInvoker$EmptyFloatingActivity"
android:exported="true"
tools:node="merge"/>
<activity
android:name=".MainActivity"
android:exported="true" <** add this line on AndroidManifest.xml**
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
</activity>
I'm not sure what you're using to code, but in order to set it in Android Studio, open the manifest of your project and under the "activity" section, put android:exported="true"(or false if that is what you prefer). I have attached an example.
I happen to know that issue in the android 12 specifically. There is already a bug raised in Android SDK. In the solution of your problem here is a file you can add in android studio and run the method.
Enable android exported file
Then run the def methods and try to build.
It is tried and tested working method.
If your app targets Android 12 or higher, you must declare these attribution tags in your app's manifest file.
If the app component includes the LAUNCHER category, set android:exported to true.
<activity
android:name="com.test.activity.SplashActivity"
android:clearTaskOnLaunch="true"
android:label="#string/app_name"
android:launchMode="singleTop"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:exported="true">
Also check receiver or service in Androidmanifest, if you are using any receiver or service set android:exported="true" or false according requirement.
<receiver
android:name="com.test.receiver.ShareReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.test.fcm.android.action.broadcast" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.tagmanager.InstallReferrerService"
android:exported="true" />
Also update all your gradle dependency.
I have updated following dependency as per requirement.
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.razorpay:checkout:1.6.15'
Hope it will help you as well.
if you are using flutter , upgrading flutter_local_notifications to the latest version (now is 9.3.2) may solve this error..
If you sure about adding exported to every element in manifest file and still got this error, simply :
switch to project directory and open merged manifest file in app\build\intermediates\merged_manifest
search for any component that contains intent-filter and didn't have exported attribute
override this component in your manifest file by copy past it to your main manifest file
tip: if you can't find merged file because it's already failed to generate it .temporary downgrade to targetSdkVersion 30 and compileSdkVersion 30 and build project to generate this file and then follow above steps and then upgrade to 31 (android 12)
This is the most common issue after upgrading your TargetSDK 32 or Android Studio with API Android 12 support.
To relate this was my error:
The errors were:
Error:
android:exported needs to be explicitly specified for element <receiver#com.onesignal.BootUpReceiver>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
D:\iptvapp\iptvapp\app\src\main\AndroidManifest.xml:99:9-103:20 Error:
android:exported needs to be explicitly specified for element <receiver#com.onesignal.UpgradeReceiver>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.
Then by using the merged Mainfest Clikc on the Libirary that has error for instacne
onesingal.
Then copy the error if its the receiver part and add it to your main manifest file as follows with
android:exported
set to true on.
and them
<receiver android:name="com.onesignal.BootUpReceiver" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
<receiver android:name="com.onesignal.UpgradeReceiver" android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
worked like a charm!
Found this solution here, works for me. This is given by official razorpay github. They've mentioned they'll fix it in next release.
<receiver
android:name="com.razorpay.RzpTokenReceiver"
android:exported="false">
<intent-filter>
<action android:name="rzp.device_token.share" />
</intent-filter>
</receiver>
<activity
android:name="com.razorpay.CheckoutActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:exported="true"
android:theme="#style/CheckoutTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data
android:host="rzp.io"
android:scheme="io.rzp" />
</intent-filter>
</activity>
Case 1: No submodules or libraries
This issue started with SDK 31. If you don't have any libraries or submodules add
android:exported="true" <!-- or false as required -->
You can right click on the tag and Android Studio will suggest you.
Case 2: With submodules or libraries
If you have other libraries or modules that you are importing, you have to override them too. For that see the tab 'Merged Manifest'.
OR You can open
<ProjectRoot>/app/build/intermediates/merged_manifest/<your
flavor>/AndroidManifest.xml
in an editor. I prefer the second method as Merged manifest doesn't allow to search from Android Studio.
Copy <activity>, <receiver> or any others causing build errors.
Paste them to Main Manifest
Add android:exported="true" or android:exported="false" as required
Rebuild
Case 3: If None of the above works
If none of the above works, you will have to wait until your library provider makes necessary changes. Until they make changes, you may revert SDK version to 30 or lower. Lowering sdk should fix the issue temporarily.
My problem was that we were using older hilt version 2.38.1:
"com.google.dagger:hilt-android:2.38.1"
"com.google.dagger:hilt-android-gradle-plugin:2.38.1"
"com.google.dagger:hilt-android-compiler:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1"
"com.google.dagger:hilt-android-testing:2.38.1" under the hood depends on core testing library 1.3.0, which does set exported properties.
To fix this, make sure you are using latest dagger hilt version (2.40.5 works):
"com.google.dagger:hilt-android:2.40.5"
"com.google.dagger:hilt-android-gradle-plugin:2.40.5"
"com.google.dagger:hilt-android-compiler:2.40.5"
"com.google.dagger:hilt-android-testing:2.40.5"
In my case I update fragment-testing to 1.5.3 version and this helped me:
dependencies {
debugImplementation androidx.fragment:fragment-testing:1.5.3
}
Just add these in build.gradle...
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.3.3"
Works like charm!
I was getting this error thrown what targeting sdk 31 and found that the solution was in my build.gradle file. I was using implementation on my compose test dependency instead of testImplementation.
Seems unrelated I know but when you look at your merge manifest with a misused test dependency you will see tags added for InstrumentedActivity which will be missing the exported=true field.
Quoting official docs about this behavior change in android 12, you should look for activities containing intent-filter and those are the ones that need to be updated by setting explicitly the value of android:exported.
Build logs should point exactly to the activity with undeclared exported flag that stopped your build. You should see something like this between the last lines of the console's output of install gradle's commands:
> java.util.concurrent.ExecutionException: com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/xxxxx.tmp/base.apk (at Binary XML file line #129): YOUR.FULLY.QUALIFIED.NAME.FAILING.ACTIVITY: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present
YOUR.FULLY.QUALIFIED.NAME.FAILING.ACTIVITY should point you to the specific activity that is blocking your build.
Here is also the link to the implications of setting android:exported.
For people with problems still using Flutter, in addition to putting exported=true in the application's <activity, you need to put it in the <activity of the installed plugins.
As I use the simpleauthflutter package, it generates an activity in androidmanifest and I put exported=true. That's the only way to work.
It will look like this:
Add
tools:node="merge"
to
<activity...
and upgrade
androidx.core.test
to latest version.
Will work like a charm :)
Copy and paste the gradle script above the root build.gradle file
Gradle Script for Android 12 Required Merge
And execute the task
doAddAndroidExportedIfNecessary
(for Add Automatically the tag required to missing activity - service - receiver )
doAddAndroidExportedForDependencies
(for Add Automatically the tag required to Dependencies missing activity - service - receiver )
Hope this script can resolved your problem
This error occur when we make the targetSkdVersion=31 for latest version 12, and the error cause if we have not use android:exported="true" in the launcher activity and android:exported="false" in other intent_filter,service or broadcast receiver.
We should write android:exported="true" only for launcher activity like this:
<activity
android:name="com.abc.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
and write android:exported="false" for service or broadcast receiver etc, like these:
<service android:name="com.startapp.sdk.adsbase.InfoEventService"
android:exported="false"/>
<service
android:name="com.startapp.sdk.adsbase.PeriodicJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"/>
<receiver android:name="com.startapp.sdk.adsbase.remoteconfig.BootCompleteListener"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
but if these services or broadcast receiver or used in the implemented library which mean it will be inside the manifest file of the library. so we will copy those service and broadcast receiver etc from those library manifest file and will paste in our main activity manifest, as like above i have copied the intent_fileter,services or broadcast receiver of the start.io sdk implented in my app to my main mainfest file.
How to copy merger manifest file to main manifest file
open your project's AndroidManifest.xml.
at the bottom of the window, click on the Merged Manifest tab.
look for any activity that includes an intent-filter tag and is missing the android:exported attribute
now copy all those to main manifest file.
Search by phrase "intent-filter" and then add " android:exported="false" to every top xml element
<receiver
android:name=".listener.SmsListener"
android:enabled="true"
android:exported="false"
>
<intent-filter android:priority="1000">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
My problem was that I didn't find all missing android:exported
I kept looking for missing android:exported="true|false". Added it everywhere I saw. Problem still persisted.
Solution
I had buildToolsVersion = "28.0.3" in gradle so the merge manifest error logs didn't help me at all.
So I upgraded to buildToolsVersion = "31.0.0" and the merge manifest showed me where the missing export was located.
Go to the AndroidManifest.xml Click Merged Manifest tab and Find the Keword in project
EG: Error: android:exported needs to be explicitly specified for element <activity#com.cpa.accountManagement.ui.authenticated.splash.SplashActivity>. 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. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details. accountManagement.app main manifest (this file), line 52
Find the "SplashActivity" Tag and add android:exported="true"
For those who are still facing this error and did not find a solution...
add this is manifest file:
<service
android:name="org.jitsi.meet.sdk.ConnectionService"
android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
android:exported="true">
<intent-filter>
<action android:name="android.telecom.ConnectionService" />
</intent-filter>
</service>

error: attribute android:useAndroidX not found

I was trying to run the app but it failed because "Android resource linking failed":
error: attribute android:useAndroidX not found.
error: failed processing manifest.
But the attribute is indeed in the file so I am not sure why it still does not work.
The attribute to enable AndroidX is available in manifest file, the debug manifest file and also the gradle properties after the project migrated to AndroidX, all the dependencies are updated so I am not sure what to do.
This is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.amethyst.within">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:icon="#drawable/ic_star_rate_on"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
android:useAndroidX="true">
<activity android:name=".NewNoteActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
</manifest>
This is the manifest debug file (above the file it is stated it is not recommended for editing, but when clicked on the error, it linked to this file):
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.amethyst.within"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="21"
android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Although the *SdkVersion is captured in gradle build files, this is required for non gradle builds -->
<!-- <uses-sdk android:minSdkVersion="14" /> -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:debuggable="true"
android:icon="#drawable/ic_star_rate_on"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:testOnly="true"
android:theme="#style/Theme.AppCompat.Light.NoActionBar"
android:useAndroidX="true" >
<activity android:name="com.amethyst.within.NewNoteActivity" />
<activity android:name="com.amethyst.within.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
<service
android:name="com.google.firebase.components.ComponentDiscoveryService"
android:exported="false" >
<meta-data
android:name="com.google.firebase.components:com.google.firebase.firestore.FirestoreRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
</service>
<activity
android:name="com.google.firebase.auth.internal.FederatedSignInActivity"
android:excludeFromRecents="true"
android:exported="true"
android:launchMode="singleTask"
android:permission="com.google.firebase.auth.api.gms.permission.LAUNCH_FEDERATED_SIGN_IN"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="com.amethyst.within.firebaseinitprovider"
android:exported="false"
android:initOrder="100" />
<activity
android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:exported="false"
android:theme="#android:style/Theme.Translucent.NoTitleBar" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<provider
android:name="com.android.tools.ir.server.InstantRunContentProvider"
android:authorities="com.amethyst.within.com.android.tools.ir.server.InstantRunContentProvider"
android:multiprocess="true" />
</application>
</manifest>
This is the gradle properties file:
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
gradle dependency file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.amethyst.within"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.jackandphantom.android:androidlikebutton:1.2.0'
implementation files('libs/forismatic-api-java.jar')
implementation 'com.google.firebase:firebase-firestore:21.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
}
Remove android:useAndroidX="true" from manifest file. It's not an existing attribute.

Packaging separate wear apks for android wear 1.x and 2.0

I am attempting to create a standalone Android Wear app for 1.x and 2. I followed the steps on the android developer page, but users say the wear apk isn't automatically installing on their 1.x watch. The mobile app has the same permissions. This is only here to get the wear apk to install. There are no activities on the mobile app.
Do I need to package the wear app in my mobile app? From what I read this shouldn't be done even for 1.x.
Here is a preview of what my apks look like in the developer console:
Mobile Manifest:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/Theme.Nav">
</application>
Wear Manifest:
<?xml version="1.0" encoding="utf-8"?>
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<!-- Required for complications to receive complication data and open the provider chooser. -->
<uses-permission android:name="com.google.android.wearable.permission.RECEIVE_COMPLICATION_DATA"/>
<application
android:name=".App"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/Theme.Nav">
<uses-library
android:name="com.google.android.wearable"
android:required="false" />
<meta-data
android:name="com.google.android.wearable.standalone"
android:value="true" />
<activity android:name=".ui.activity.SplashActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Translucent.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Main activity for music browsing on phone -->
<activity android:name=".ui.activity.MainActivity"
android:launchMode = "singleTop">
</activity>
<service android:name=".service.MediaPlayerService" />
<activity android:name="android.support.wearable.activity.ConfirmationActivity" />
<!--
Main music service, provides media browsing and media playback services to
consumers through MediaBrowserService and MediaSession. Consumers connect to it through
MediaBrowser (for browsing) and MediaController (for play session control)
-->
<service android:name=".service.FsService" />
<service android:name=".service.NsdService" />
<receiver
android:name=".service.NsdService$StartStopReceiver"
android:exported="false">
<intent-filter>
<action android:name="com.turndapage.navmusic.FTPSERVER_STARTED" />
<action android:name="com.turndapage.navmusic.FTPSERVER_STOPPED" />
</intent-filter>
</receiver>
<!-- Don't export this receiver in free, this clashes with paid -->
<receiver
android:name=".RequestStartStopReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.turndapage.navmusic.ACTION_START_FTPSERVER" />
<action android:name="com.turndapage.navmusic.ACTION_STOP_FTPSERVER" />
</intent-filter>
</receiver>
<receiver android:name=".WifiStateChangeReceiver">
<intent-filter>
<action android:name="android.net.wifi.STATE_CHANGE" />
</intent-filter>
</receiver>
<service android:name=".WifiStateChangeReceiver$StartServerService" />
<service android:name=".WifiStateChangeReceiver$StopServerService" />
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<service
android:name=".watchface.AnalogComplicationWatchFaceService"
android:enabled="true"
android:label="#string/my_analog_name"
android:permission="android.permission.BIND_WALLPAPER">
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/watch_face" />
<meta-data
android:name="com.google.android.wearable.watchface.preview"
android:resource="#drawable/preview_analog" />
<meta-data
android:name="com.google.android.wearable.watchface.preview_circular"
android:resource="#drawable/preview_analog" />
<meta-data
android:name="com.google.android.wearable.watchface.wearableConfigurationAction"
android:value="com.turndapage.navmusic.CONFIG_COMPLICATION_SIMPLE"/>
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
<activity android:name="android.support.wearable.complications.ComplicationHelperActivity"/>
<activity
android:name=".config.AnalogComplicationConfigActivity"
android:label="#string/analog_complication_config">
<intent-filter>
<action android:name="com.turndapage.navmusic.CONFIG_COMPLICATION_SIMPLE"/>
<category android:name="com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<receiver android:name=".provider.ComplicationToggleReceiver"/>
<activity android:name=".config.ColorSelectionActivity"/>
<service android:name=".provider.CurrentSongComplicationProvider"
android:icon="#drawable/ic_library_music_white_24dp"
android:label="#string/current_song"
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER">
<intent-filter>
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/>
</intent-filter>
<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="SHORT_TEXT,LONG_TEXT"/>
<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="0"/>
</service>
<service android:name=".provider.SkipBackComplicationProvider"
android:icon="#drawable/ic_skip_previous_white_24dp"
android:label="#string/skip_back"
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER">
<intent-filter>
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/>
</intent-filter>
<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="ICON"/>
<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="0"/>
</service>
<service android:name=".provider.SkipForwardComplicationProvider"
android:icon="#drawable/ic_skip_next_white_24dp"
android:label="#string/skip_next"
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER">
<intent-filter>
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/>
</intent-filter>
<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="ICON"/>
<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="0"/>
</service>
<service android:name=".provider.PlayPauseComplicationProvider"
android:icon="#drawable/ic_media_play_dark"
android:label="#string/play_pause"
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER">
<intent-filter>
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST"/>
</intent-filter>
<meta-data
android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="ICON"/>
<meta-data
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS"
android:value="0"/>
</service>
<!-- Watch face stuff -->
</application>
Mobile Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.turndapage.navmusic"
minSdkVersion 15
targetSdkVersion 26
versionCode 260350011
versionName "0.3.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
wearAppUnbundled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Wear gradle:
plugins {
id "me.tatarka.retrolambda" version "3.5.0"
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.turndapage.navmusic"
minSdkVersion 23
targetSdkVersion 26
versionCode 260350010
versionName "0.3.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// Needed for retrolambda
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.android.support:wearable:2.0.3'
compile 'com.android.support:wear:26.0.1'
compile 'com.google.android.gms:play-services-wearable:11.0.4'
compile 'com.google.android.exoplayer:exoplayer:r2.4.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.github.kabouzeid:app-theme-helper:1.3.7'
compile 'com.android.support:support-v4:26.0.1'
compile 'com.android.support:design:26.0.1'
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:preference-v7:26.0.1'
compile 'com.android.support:mediarouter-v7:26.0.1'
compile 'com.android.support:percent:26.0.1'
compile 'net.vrallev.android:cat:1.0.5'
compile 'org.projectlombok:lombok:1.16.18'
compile 'com.twofortyfouram:android-plugin-client-sdk-for-locale:4.0.2'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
compile 'com.google.android.gms:play-services-fitness:11.0.4'
compile 'com.android.support:palette-v7:26.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC1'
provided 'com.google.android.wearable:wearable:2.0.3'
}
[Edit] I had to update to include complication permissions and remove the watch feature on the mobile app to get it to upload to the play store. Some users report it is installing, but others can't get it to work.
Your assumption is correct, you should not embed the wear APK inside the phone APK (this was the old way of doing it). However, you still need to publish the phone APK.
There are only 2 APKs in your screen shot. There should be 3 in total: phone APK for AW 1.x, wear APK for AW 1.x, and wear APK for AW 2.x.
Make sure that the AW 2.0 APK has the highest version code, followed by the AW 1.x watch APK, and finally the AW 1.x phone APK.
Note that that the wearAppUnbundled true flag (in your phone gradle file) is only needed if you've previously published an AW 1.x app with an embedded wear APK (but it shouldn't hurt to include it otherwise).

Categories

Resources