related with flutter gradle version - flutter

I changed some codes in gradle files for using external project.
but now facing with problems below, how can I work arrange these?
/AndroidManifest.xml Error:
android:exported needs to be explicitly specified for element <activity#com.example.awesome_flutter_layouts.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:processDebugMainManifest'.
Manifest merger failed : android:exported needs to be explicitly specified for element <activity#com.example.awesome_flutter_layouts.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 5s
Exception: Gradle task assembleDebug failed with exit code 1

<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>
try to add android:exported="true"

Related

ERROR:AAPT: error: resource style/Theme.Design.NoActionBar (aka com.communilifer.markclassified:style/Theme.Design.NoActionBar) not found

when I try to build a flutter android app after
rising targetSdkVersion to 32 instead of 31
I got this 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:AAPT: error: resource style/Theme.Design.NoActionBar (aka com.communilifer.markclassified:style/Theme.Design.NoActionBar) not found.
error: failed linking references.
this is AndroidManifest.xml activity tag
<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">
i searched everyWhere can't find any solution
can anyone help?

i am building zoom clone(flutter) using jitsi meet ,while runing the app on android emulator i am getting these error

1:19 Error:
android:exported needs to be explicitly specified for element <service#org.jitsi.meet.sdk.ConnectionService>. 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:processDebugMainManifest'.
Manifest merger failed : android:exported needs to be explicitly specified for element <service#org.jitsi.meet.sdk.ConnectionService>. 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 9s
Running Gradle task 'assembleDebug'... 11.3s
Exception: Gradle task assembleDebug failed with exit code 1
➜ untitled1
have you resolved this yet? if not, paste the below code inside the '<application></application>' of your AndroidManifest.xml
<application>
...
<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>
</application>
Let me know if it works for you.

When I run a Flutter project, it says "build failed due to use of deprecated android v1 embedding" [duplicate]

I have an error in the flutter project that I cloned from GitHub. I tried this method but it didn't work
<application
android:name="io.flutter.app.FlutterApplication"
To:
<application
android:name="${applicationName}"
error:
AndroidManifest.xml:
It may sound like a fake solution, but indeed, the easiest way to resolve this is:
Delete the android folder.
Run flutter create .
The command will recreate the android folder with the already migrated code. Also, the command will create folders for the other stable platforms (e.g. web, windows), so you could ignore those and just delete them or trigger the flutter create command by defining android platform - flutter create --platforms=android ..
The best solution I found when I got this problem with my older Flutter projects is to start fresh.
Rename the old project folder.
Create a new Flutter project using the latest Android Studio or command line.
Copy/paste the old code from your backup folder.
Be careful not to replace any of the control files: pubspec.yaml, Android folder, iOS folder, Gradle, etc.
You will find the problem solved.
Add the following code in android manifest after activity
<meta-data
android:name="flutterEmbedding"
android:value="2" />
In project build.gradle add the following code in buildscript
ext.kotlin_version = '1.6.10'
And change gradle version in gradle-wrapper.properties
My manifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.stackoverflowexample">
<application
android:label="stackoverflowexample"
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>
Add below lines in AndroidManifest.xml file
<meta-data
android:name="flutterEmbedding"
android:value="2" />
For more details : https://docs.flutter.dev/release/breaking-changes/android-v1-embedding-create-deprecation

Flutter build failed due to use of deprecated Android v1 embedding

I have an error in the flutter project that I cloned from GitHub. I tried this method but it didn't work
<application
android:name="io.flutter.app.FlutterApplication"
To:
<application
android:name="${applicationName}"
error:
AndroidManifest.xml:
It may sound like a fake solution, but indeed, the easiest way to resolve this is:
Delete the android folder.
Run flutter create .
The command will recreate the android folder with the already migrated code. Also, the command will create folders for the other stable platforms (e.g. web, windows), so you could ignore those and just delete them or trigger the flutter create command by defining android platform - flutter create --platforms=android ..
The best solution I found when I got this problem with my older Flutter projects is to start fresh.
Rename the old project folder.
Create a new Flutter project using the latest Android Studio or command line.
Copy/paste the old code from your backup folder.
Be careful not to replace any of the control files: pubspec.yaml, Android folder, iOS folder, Gradle, etc.
You will find the problem solved.
Add the following code in android manifest after activity
<meta-data
android:name="flutterEmbedding"
android:value="2" />
In project build.gradle add the following code in buildscript
ext.kotlin_version = '1.6.10'
And change gradle version in gradle-wrapper.properties
My manifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.stackoverflowexample">
<application
android:label="stackoverflowexample"
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>
Add below lines in AndroidManifest.xml file
<meta-data
android:name="flutterEmbedding"
android:value="2" />
For more details : https://docs.flutter.dev/release/breaking-changes/android-v1-embedding-create-deprecation

Android resource linking failed Flutter

I am running into this weird issue where I am getting this error.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\live\project_backup\build\file_picker\intermediates\library_manifest\debug\AndroidManifest.xml:9:5-15:15: AAPT: error: unexpected element <queries> found in <manifest>.
* 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
Weird thing is this happens after I upgrade file_picker package and persists even if I downgrade in pubspec.yaml again. But when I try run the project from the backup and replace lib folder with the one where this error occurred, it works perfectly. When this error occurs, plugin downgrade, flutter clean doesn't work. Why is this issue happening? When I click on the error link I am redirected to file_picker->intermediate->library_manifest->debug->Android Manifest.xml and the code there looks as below.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mr.flutter.plugin.filepicker" >
<uses-sdk android:minSdkVersion="16" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<queries>
<intent>
<action android:name="android.intent.action.GET_CONTENT" />
<data android:mimeType="*/*" />
</intent>
</queries>
Any suggestions on what is wrong and how to fix this?
I just found out the solution, queries is a new manifest element and require to use a new gralde android plugin.
so change to this version in build.gradle, this worked for me
classpath 'com.android.tools.build:gradle:4.1.0'
Also change gradle-wrapper version to 6.5 as it is required by 4.1.0 plugin
EDIT:
use this if and only if app does not work in release mode, otherwise use above method.
use file_picker version file_picker: 2.0.7 remember without ^ symbol. use android gradle plugin 3.5 only and don't migrate to 4.1.0.