How do I override values in Androidmanifest.xml file? - android

I have this error that says I need to override some values in one the Android.xml files. Despite changing the values, as suggested, I keep getting the same error. At times the values in the AndroidManifest.xml wouldn't even change even after saving.
Here below you'll see the error message when building:
What went wrong:
Execution failed for task ':cloud_firestore:processDebugAndroidTestManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 23 declared in library [com.google.firebase:firebase-firestore:24.1.2] C:\Users\DELL.gradle\caches\transforms-3\2bfce4225340219067212fe3be9c89b6\transformed\jetified-firebase-firestore-24.1.2\AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 23,
or use tools:overrideLibrary="com.google.firebase.firestore" to force usage (may lead to runtime failures)
The build.gradle file:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 32
//buildToolsVersion "30.0.2"
lintOptions {
//disable 'InvalidPackage'
abortOnError false
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
configurations.all {
resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }
}
applicationId "com.praveeshramroop.athena"
minSdkVersion 23
targetSdkVersion 32
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
The AndroidManifest.xml 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="com.google.firebase.firestore"
android:versionName="24.1.2" >
<uses-sdk
android:minSdkVersion="23"
android:targetSdkVersion="32"
tools:overrideLibrary="com.google.firebase.firestore"/>
<!-- 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" />
<uses-permission android:name="android.permission.INTERNET" />
<application>
<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" />
</service>
</application>
</manifest>
As you can see, I've done everything as recommended. The values are correct in both the build.gradle and AndroidManifest.xml file. But still getting the same error, don't know why. Anything else I should do? If any additional information required, do let me know.

Related

how to solve = Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported`?

After upgrading to Android Studio Dolphin | 2021.3.1, the application is not compiling. It shows
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
I have set all the activity with android:exported="false". But it is still showing this issue.
My manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.something">
<application
android:requestLegacyExternalStorage="true"
android:label="something"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="false"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
>
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<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.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
My gradle file:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw GradleException("Flutter SDK not found. Define location with flutter.sdk in
the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '11'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '11.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 33
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID
(https://developer.android.com/studio/build/application-id.html).
applicationId "com.something.something1.com"
minSdkVersion 21
targetSdkVersion 33
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ?
file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:28.2.1')
implementation 'com.google.firebase:firebase-analytics'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
OPTION 1
You need to set android:exported to either true or false in your AndroidManifest.xml.(which you have done)
OPTION 2
Downgrade your project to an older SDK version, then rebuild project.
After a successful build, open your project's AndroidManifest.xml.
Click on the Merged Manifest tab at the bottom of the file and search for any <activity> that includes an <intent-filter> tag and is missing the android:exported attribute
To confirm that these activities are the issue, add them directly to your project's AndroidManifest.xml file with the missing android:exported attribute added and try rebuilding the project.
If <activity android:name="com.example.MainActivity"> is missing the android:exported attribute, add it to your AndroidManifest.xml file.
OPTION 3
You are using a library that doesn't target Android 12 yet. You can either upgrade the version if there is or remove it.
Good luck!
if you are using other packages or libraries, some of these libraries may not have set android:exported=”false” or android:exported=”true” in their Manifest files.
If you do not want to update those packages to the latest, we will have to over-ride their manifest files in the app's Manifest file.
So Step 1 is to find which package/libraries manifest files are missing the android:exported=”false” or android:exported=”true” .
This is done by downgrading your targetSdkVersion to 30 so that it compiles correctly. When the app compiles correctly it will generate a mergedManifest file in
build/app/intermediates/merged_manifests/debug/AndroidManifest.xml and
build/app/intermediates/merged_manifest/debug/AndroidManifest.xml
Step2: After you find the services / packages missing the android:exported=”false” or android:exported=”true”, we will copy those activities directly to app/src/res/AndroidManifest.xml and add in android:exported=”false” or android:exported=”true”.
If you got this messages from your android studio, in your main activity add in android:exported=”false” or android:exported=”true” will solved this issue.

Flutter App not installable from Google store for Android 12

I'am trying to start internal testing for my flutter App in the Google Play Console. It works for other devices except those with Android 12. On Android 12 I'm not able to install the App. But the App runs flawlessly on an Android 12 Emulator.
I've already followed the instructions at this question
Flutter App not installable from Google store for Android 12 despite being set to targetSDK 31. Because it didn't work either, I created a new clean Flutter project and uploaded it without changing anything. The result was the same: The app was downloadable on all devices except the ones with Android 12.
My build.gradle file:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "myAppId"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
Flutter doctor:
It worked now in Open testing after getting the app reviewed.
upgrade your projet to one of the most recents flutter versions, updgrade your dependancies and change all
<service></service>
tags in all your dependancies like below
<servive
....
android:exported="true">
</service>
in all AndroidManifest.xml files

Execution failed for task ':app:processDebugResources' in flutter

im having this i dont why im getting this
even my all sdk versions are updated
the code was running perfectly then i closed the program and restarted , it started sgowing this error
here's my android/build.gradle
buildscript {
ext.kotlin_version = '1.6.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and android/src/build.gradle
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.hivemusic.in.hivemusic"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
here's my androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hivemusic.in.hivemusic"
android:versionCode="1"
android:versionName="1.0.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="31" />
<!--
Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="android.app.Application"
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
android:debuggable="true"
android:icon="#mipmap/ic_launcher"
android:label="hivemusic" >
<activity
android:name="com.hivemusic.`in`.hivemusic.MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:windowSoftInputMode="adjustResize" >
<!--
Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI.
-->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java
-->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<uses-library
android:name="androidx.window.extensions"
android:required="false" />
<uses-library
android:name="androidx.window.sidecar"
android:required="false" />
</application>
</manifest>
i guess i've messed somewhere even i have updated my flutter still im having this idk where is the problem i'll be glad if you help me

Flutter App not installable from Google store for Android 12 despite being set to targetSDK 31

I have a Flutter App in the Playstore and if you have Android 12, it will just pop an Error Message:
"AppName cannot be installed"
My Flutter version is 2.5.0
I would expect the app to be installable on Android 12 because of my settings. Are there any òther reasons this could fail?
This is my build.grade:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '25'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.1.0'
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
// apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 31
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "myAppID"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
//signingConfig signingConfigs.debug
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug{
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//def multidex_version = "2.0.1"
//implementation 'androidx.multidex:multidex:$multidex_version'
implementation 'com.android.support:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
Flutter Doctor:
Installing this on an Android 12 Emulator, the install fails with this message:
After I did add this value as true to my appmanifest, I started it again and I have an endless install loading icon in visual studio code. I have the app on the device, but it will close immidiately after tapping on it
You have to set android:exported to any <activity>, <activity-alias>,<service>, or <receiver> components that have <intent-filter>s declared in the app’s AndroidManifest.xml file.
ALSO!!!!
You have to do the same for every package you use. I would advice NOT doing it manually as this could get modified by calling something like "Pub clear cache" and instead try to update your packages to the latest version.
https://medium.com/androiddevelopers/lets-be-explicit-about-our-intent-filters-c5dbe2dbdce0
When I was stuck for this issue, did not found anything helpful on the web: not many people seems to encountered this.
I tried creating fresh new flutter app, copying its /android folder to my old project; setting android:exported for in AndroidManifest.xml: none of helped for running my app on Android 12 device. (Also there were some Android 11 devices, all of them being SAMSUNG, that our app, of which target sdk was set to 31, could not be installed.
Finally setting targetSdkVersion as 30 and compileSdkVersion as 30, fixed the issue.
SDK version 30 and Android 12? Weird.
just follow steps :
1 set targetSdkVersion and compileSdkVersion 32
2 open AndroidManifest.xml , in application tag add this -
usesCleartextTraffic="true"
androidSupportRtl="true"
3 set android:exported="true" in activity

Generate android App Bundle with x86 version

I use flutter to develop my app. However, to generate an app bundle and upload it to play console, I use Android Studio (Build -> Generate Signed Apk).
In flutter I have the option of generating three distinct apks for three architectures (arm, arm64 and x86(64?)) through flutter build commands. However when I generate signed app bundle from Android Studio and upload it play console, I only get two build variants or abi (arm64-v8a, armeabi-v7a). How do I make my app bundle include an x86 abi?
Additional: I only use Android Studio to generate App Bundle. I use VS Code to write these apps.
Edit: The module/App level build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.spayro.spayroshop"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
The x86 architecture is not supported at this time.
https://flutter.dev/docs/deployment/android#what-are-the-supported-target-architectures
Please put this code in your gradle:
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
example
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.test.test"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}

Categories

Resources