flutter android gradle error with flutterdownloader - android

I have implemented flutterDownloader (its a package for downloading files in flutter ) in my project and when I add it to android manifest like the doc says and when I do that gradle shows this error
**error : **
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:generateDebugBuildConfig'.
> org.xml.sax.SAXParseException; systemId: file:/C:/Users/fahmi/mscmu/android/app/src/main/AndroidManifest.xml; lineNumber: 27; columnNumber: 35; The prefix "tools" for attribute "tools:node" associated with an element type "provider" is not bound.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1
my android manifest->
Android Manifest :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kivoc99.mscmu">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name="io.flutter.app.FlutterApplication"
android:label="mscmu"
android:icon="#mipmap/ic_launcher">
<provider
android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
android:authorities="${applicationId}.flutter_downloader.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths"/>
</provider>
<provider
android:name="androidx.work.impl.WorkManagerInitializer"
android:authorities="${applicationId}.workmanager-init"
tools:node="remove" />
<provider
android:name="vn.hunghd.flutterdownloader.FlutterDownloaderInitializer"
android:authorities="${applicationId}.flutter-downloader-init"
android:exported="false">
<!-- changes this number to configure the maximum number of concurrent tasks -->
<meta-data
android:name="vn.hunghd.flutterdownloader.MAX_CONCURRENT_TASKS"
android:value="5" />
</provider>
<activity
android:name=".MainActivity"
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">
<!-- 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"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<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>
</manifest>
what is the problem here ? I have tried to do exactly what the docs says , any help ?

you have to bind the tools attribute to your manifest element:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="[YOUR APP NAME]" xmlns:tools="http://schemas.android.com/tools" >

I just solved it! You need to add this line to the manifest tag it's actually the first tag in the file: xmlns:tools="http://schemas.android.com/tools"

Related

How to fix Execution failed for task ':app:processDebugManifest' in flutter

I find an error when run the project, I try to look for many examples but fail all, this is the detail of error:
Building with sound null safety
Parameter format not correct -
P:\Make hole crypto\academy-lms-mobile-app-flutter-ios-android20 1\academyapp-master\academyapp-master\android\app\src\main\AndroidManifest.xml:12:9-48:20 Error:
android:exported needs to be explicitly specified for element <activity#com.example.academy_app.MainActivity>. 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.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseMainManifest'.
> Manifest merger failed : android:exported needs to be explicitly specified for element <activity#com.example.academy_app.MainActivity>. 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.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 24s
Running Gradle task 'assembleRelease'... 25.7s
Gradle task assembleRelease failed with exit code 1
P:\Make hole crypto\academy-lms-mobile-app-flutter-ios-android20 1\academyapp-master\academyapp-master>
My AndroidManifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.academy_app">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:label="Academy LMS"
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
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">
<!-- 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"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Deep Linking -->
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
<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="academybycreativeitem" />
</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" />
<provider
android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
android:authorities="${applicationId}.flutter_downloader.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths"/>
</provider>
</application>
</manifest>
Please help me This is in the flutter app for android and ios.
[√] Flutter
[√] Android toolchain
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.70.1)
[√] Connected device (3 available)
[√] HTTP Host Availability
Please help me This is in the flutter app for android and ios.

How to add '.in' domain for flutter app to avoid Android resource linking error?

I'm making a flutter project with the cmd:
flutter create --org in.fiesto lafiesto
This command puts 'in' under backticks- `in` in the MainActivity.kt file because 'in' is a keyword.
When I run the app it throws the following error:
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
Android resource linking failed
ERROR:/home/abhi/Documents/Fiesto/lafiesto/build/app/intermediates/packaged_manifests/debug/AndroidManifest.xml:2: AAPT: error: attribute 'package' in tag is not a valid Android package name: '`in`.fiesto.lafiesto'.
This package name in the build/.../AndroidManifest.xml file:
package="`in`.fiesto.lafiesto"
The contents of MAinActivity.kt are:
package `in`.fiesto.lafiesto
import io.flutter.embedding.android.FlutterActivity
class MainActivity: FlutterActivity() {
}
And the android>src> AndroidManifest.xml file has:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.fiesto.lafiesto">
<application
android:label="lafiesto"
android:name="${applicationName}"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
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">
<!-- 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" />
</application>
</manifest>
The android>debug AndroidManifest.xml file has:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.fiesto.lafiesto">
<application
android:label="lafiesto"
android:name="${applicationName}"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
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">
<!-- 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" />
</application>
</manifest>
I tried changing minSdk, targetSdk, compileSdk and other things in build.gradle file and also tried changing "package=in.fiesto.lafiesto" to "package=`in`.fiesto.lafiesto" in AndroidManifest.xml files but nothing worked.
Please suggest how to deal with this problem.
flutter create -i objc -a java --org in.fiesto lafiesto solved the problem. It created a Java folder under android>src>main which has two folders named "in" and "io", there's no kotlin folder. I don't know if this will have any drawbacks or not!

INSTALL PARSE FAILED MANIFEST MALFORMED: Failed parse

I am new to Flutter & I am trying to run an existing app on VS Code. I get this error message on my terminal when I attempt to run it on the Android emulator:
Error: ADB exited with exit code 1
Performing Streamed Install
adb: failed to install
/Users/tazar/Downloads/ethereal-meditations-app-made-app-runnable/build/app/outputs/flutter-apk/app
.apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI:
/data/app/vmdl469477611.tmp/base.apk (at Binary XML file line #260):
com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver: Targeting S+ (version 31
and above) requires that an explicit value for android:exported be defined when intent filters are
present]
Error launching application on sdk gphone64 arm64.
This is my AndroidManifest.xml file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="path">
<application
android:label="---"
android:icon="#mipmap/ic_launcher">
<!-- FACEBOOK LOGIN -->
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:exported="true"
android:value="#string/facebook_app_id"/>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:exported="true"
android:label="#string/app_name" />
<activity
android:name="com.facebook.CustomTabActivity"
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="#string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<!-- END FACEBOOK LOGIN -->
<activity
android:name=".MainActivity"
android:exported="true"
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">
<!-- 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"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<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" />
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<!-- EM account: android:value="ca-app-pub-3706741424467059~5052028195"/> -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-3706741424467059~5052028195"/>
<!-- android:value="ca-app-pub-8622122832922913~9459724912"/> -->
<!-- android:value="ca-app-pub-3940256099942544~3347511713"/> -->
</application>
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
The app runs fine on the browser, but not on the emulator. When I attempted to solve this issue, everywhere I looked, I was told to add "android:exported='true'" to each activity. I made those changes, but I still get the same error. I am kinda stuck now & I don't know what to do. Please feel free to share your thoughts, I would really appreciate it.
you have to follow these rules to migrate from targetSdk 30 to 31
https://developer.android.com/google/play/requirements/target-sdk#pre12
As far as I see it your manifest is missing this point
Intent filters: If your app contains activities, services, or
broadcast receivers that use intent filters, you must explicitly
declare the android:exported attribute for these components.

Why my Flutter app is not building while executing?

I have been trying to build a flutter app. But while exporting/building it an error came. The error message while building:
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart:1
C:\dev\bmi\android\app\src\main\AndroidManifest.xml Error:
Package name 'BMI' at position AndroidManifest.xml:2:5-18 should contain at least one '.' (dot) character
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : Package name 'BMI' at position AndroidManifest.xml:2:5-18 should contain at least one '.' (dot) character
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 21s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
andriodmainifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="BMI">
<!-- 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"/>
</manifest>
Error is on your package name given in manifest file.
You can add package name as com.bmi or so on.
Kindly refer below added manifest file from my project.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bmi">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
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" />
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="io.flutter.network-policy"
android:resource="#xml/network_security_config" />
<!-- 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>
</manifest>

Error: ADB exited with exit code 1 Performing Streamed Install adb: failed to install Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED:

I am cloning Repo and facing this issue
as im using android emulator in macbook air M1
my AndroidMenifest.xml is as below
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.gc">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<application
android:label="Green Co"
android:allowBackup="false"
android:fullBackupOnly="false"
android:icon="#mipmap/ic_launcher">
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="-----------------------------"/>
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="#string/default_notification_channel_id" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#mipmap/ic_launcher" />
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
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"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</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" />
<!-- Add your Google Maps API Key here -->
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="----------------------------"/>
</application>
</manifest>
and im facing the error
Error: ADB exited with exit code 1 Performing Streamed Install
adb: failed to install
/Users/gajanan/Ampra/flutter/greencorridor_package/build/app/outputs/flutter-apk/app.apk:
Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during
installPackageLI: /data/app/vmdl760273936.tmp/base.apk (at Binary XML
file line #64): com.ampra.greencorridor.MainActivity: Targeting S+
(version 31 and above) requires that an explicit value for
android:exported be defined when intent filters are present] Error
launching application on sdk gphone64 arm64.
Hoping to find some solution about it
its really appriciate if some one help me to find the solution for this!!!
You need to add this line of code within the activity in the above AndroidManifest.xml file -
android:exported="true"

Categories

Resources