Flutter - Ultimate collection of solution to errors

This guide is meant to collect all the errors that have gave me so much headache with the solutions, so you'll not waste your precious time like I did :(

Keep in mind that this list will be in constant update, so you may not find a solution at one point of time but the next day you may find it.

Google ads error AAPT

The error was this one here

"play-services-ads-lite-20.1.0/AndroidManifest.xml:27:5-43:15: AAPT: error: unexpected element <queries> found in <manifest>"

Problem with Google ADS, with this problem I have lost a ton of time, at the end the solution was to update the gradle version not the distributionUrl, in my case nothing happened but in another file

under "android > build.gradle"

dependencies {
    // Update this line here
    classpath 'com.android.tools.build:gradle:4.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

At the end I have update also the distributionURL under gradle-wrapper.properties Change the line to this new version 

"android > gradle > wrapper > gradle-wrapper.properties"

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

Mapping when building your App

Everything was working fine the only problem is that everytime on my console was logging this messages

shell
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

My solution was, in my case, I have tried multiple things like updating the build tools in the Android Studio settings but nothing worked sooo.... 

I have remove Android Studio and all his files and reinstalled everything as new, yes it is not cool but it worked! And It was the only way in which I have solved this problem.

App stuck during build

My application was stuck on building at the message "Running Gradle task 'assembleDebug'... ", every time would stop without any error message. If I type the command "flutter run -v" would break every time with an error message, using "flutter clean" or deleting other folders did not help.

The error messages was: 

   - "Execution failed for task ':app:processDebugResources'." 

   - "resource android:attr/lStar not found."

The problem was about gradle, even deleting .gradle file did not help, I have also deleted .gradle from my home folder but nothing, same exact problem, every time would give a differrent error and stop.

I have also changed the version of gradle, and things started to look a little bit better, I was having error messages with gradle incopabilities, after many try and error I have found the solution for now.

In order it to work you have to insert exactly this combination of versions, cause I have tried many versions and did not work, the only thing was this exact combination.

Usually the last line insert or change 

"android > gradle > wrapper > gradle-wrapper.properties"

distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

Then go to this other file and change the gradle version to 4.1.0

"android > build.gradle"

dependencies {
    classpath 'com.android.tools.build:gradle:4.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

The last thing is to update you build cause probably wont work if with this gradle version, but you could try before changing this one, it's your choice

You have to change 2 places compleSdkVersion and targetSdkVersion to 30 since it is the minimum

"android > app > build.gradle"

android {
		compileSdkVersion 30

		...
		...

        defaultConfig {
            ...
			...
        	targetSdkVersion 30
flutter error flutter how to solve flutter how to fix flutter solution error flutter collection to solutions and errors flutter errors
Expand your knowledge about this topic