app bundle not building after update of flutter where as app debug builds but not app release - flutter

My Error Code
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 2m 35s
Running Gradle task 'bundleRelease'... 158.6s
[!] App requires Multidex support
Multidex support is required for your android app to build since the number of methods has exceeded 64k. You may
pass the --no-multidex flag to skip Flutter's multidex support to use a manual solution.

You need to add below code in app/build.gradle file to enable multidex support.
defaultConfig {
multiDexEnabled true
....
}
See Enable multidex for apps with over 64K methods for details.

Related

I don't understand what is my problem Firebase?

One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to C:\Users\User\AndroidStudioProjects\tour\android\app\build.gradle:
android {
compileSdkVersion 33
...
}
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not find com.google.android.material:material:<version>.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/google/android/material/material/<version>/material-<version>.pom
- https://repo.maven.apache.org/maven2/com/google/android/material/material/<version>/material-<version>.pom
- https://storage.googleapis.com/download.flutter.io/com/google/android/material/material/<version>/material-<version>.pom
- https://jcenter.bintray.com/com/google/android/material/material/<version>/material-<version>.pom
Required by:
project :app
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
Your compileSdkVersion is low try to increase it to 33 to do this:
open the android/app/build.gradle file in your project, and find the android block. Inside this block, you should see a compileSdkVersion setting. This setting specifies the version of the Android SDK that your app is built against. The error message indicates that you need to update this setting to a higher version (currently 33) to fix the issue.
android {
compileSdkVersion 33
// Other settings here...
}
and rebuild your app

App requires Multidex support in flutter?

I'm getting this error while building my app in Flutter. it seems the problem that the multidex is not enabled even though I did everything needed to enable it. this the error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeProjectDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Type androidx.activity.R$attr is defined multiple times: C:\Users\Abdul rehman\OneDrive\Desktop\CSC451\Capstone Project\harfanah\build\app\intermediates\project_dex_archive\debug\out\4b5c628c7fbb96e2839e63f71f8803802c039de25c33dd9c9475187dc45e6e1a_1.jar:classes.dex, C:\Users\Abdul rehman\OneDrive\Desktop\CSC451\Capstone Project\harfanah\build\app\intermediates\project_dex_archive\debug\out\9bd7ed05083b8d3edbf142363966d832d9f0694faefda4d175e3ad8ad18fc06d_1.jar:classes.dex
* 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 30s
[!] App requires Multidex support
Flutter multidex handling is disabled. If you wish to let the tool configure multidex, use the --mutidex flag.
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I have already checked all of the solutions.
enabled Multidex support and used the latest version:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.harfanahApplication.harfanah"
minSdkVersion 21
targetSdkVersion 32
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
.
.
.
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation("androidx.multidex:multidex:2.0.1")
}
I also added these to gradle.properies
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
Still it is not working. any suggestions?
Have you tried "flutter clean" and then rebuild? You can let the Flutter CLI tool do it for you with "flutter build --multidex".
use flutter clean and
flutter pub get
then you will get a notification on whether you need to install it or not.
type y (yes) to it .then use flutter run
I had the same issue on a Mac M1(2021). To debug on an android device, I extended #AntEdode's solution a bit:
flutter build apk --multidex --debug
During build, the same error will pop up, however the SDK will now ask whether or not you want to install multidex:
[!] App requires Multidex support
Multidex support is required for your android app to build since the number of methods has exceeded 64k. You may pass the --no-multidex
flag to skip Flutter's multidex support to use a manual solution.
Flutter tool can add multidex support. The following file will be added by flutter:
android/app/src/main/java/io/flutter/app/FlutterMultiDexApplication.java
Do you want to continue with adding multidex support for Android? [y|n]:
After confirmation - voila:
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
To run on your emulator:
flutter run --multidex

NDK not configured. Download it with SDK manager when compile flutter app

Today when I compile the flutter(2.5.1) app, show error like this:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':system_clock'.
> NDK not configured. Download it with SDK manager. Preferred NDK version is '21.1.6352462'.
* 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 1s
Exception: Gradle task assembleDebug failed with exit code 1
I have already checked the NDK configuration and make sure the version is installed:
why the project prefer another version of NDK version? what should I do to configure the right version of NDK?
Just check '21.1.6352462' in NDK and press ok.
It'll do the rest.
Or check this issue
https://github.com/flutter/flutter/issues/53657

Failed to build APK for flutter app and show me this error

I am trying to build a release APK for flutter app for existing app ,when I run flutter build apk --release, I got this error
I built the app before upgrading Flutter to Channel beta (now I am using flutter to develop a website
Can anyone help me please?
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration
':flutter_plugin_android_lifecycle:debugUnitTestRuntimeClasspath'.
> Could not download mockito-core.jar (org.mockito:mockito-core:1.10.19)
> Could not get resource 'https://jcenter.bintray.com/org/mockito/mockito-core/1.10.19/mockito-
core-1.10.19.jar'.
> Could not GET 'https://d29vzk4ow07wi7.cloudfront.net/e8546f5bef4e061d8dd73895b4e8f40e3fe6effe?
response-content-disposition=attachment%3Bfilename%3D%22mockito-core-1.10.19.jar%22&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHAqOi8vZDI5dnprNG93MDd3aTcuY2xvdWRmcm9udC5uZXQvZTg1NDZmNWJlZjRlMDYxZDhkZDczODk1YjRlOGY0MGUzZmU2ZWZmZT9yZXNwb25zZS1jb250ZW50LWRpc3Bvc2l0aW9uPWF0dGFaG1lbnQlM0JmaWxlbmFtZSUzRCUyMm1vY2tpdG8tY29yZS0xLjEwLjE5LmphciUyMiIsIkNvbmRpdGlvbiI6eyJEYXRlTGVzc1RoYW4iOnsiQVdTOkVwb2NoVGltZSI6MTYwMzY1NDc2MX0sIklwQWRkcmVzcyI6eyJBV1M6U291cmNlSXAiOiIwLjAuMC4wLzAifX19XX0_&Signature=lu5rAbocUI2DuLDQ79CKz2UnjGl1smkhuOD3cR~iEunjBAfYD6VYxTLZD5vuiHnmr7avMhSI96FKGjaXzKSolqEGPSieDVuXqSMaJ7HryIRL693ykuFQi-RpTgk9k6PNJLPkcWjhrlsmJzNejwr0PwXtsJytAEUhsLhIR4MPey04ryOGTn~tFLMuOzCR46bYW0Bd8yyFA~cygPipbqRHc8M-Yj2Fjp-FfAUouQTIrEEdDmh2QgtiKpyBRSSmKbUvFf9gQ5GJa13P30mjyFHuHpK8J5hexyatUSOmDFbFYta2vQR7h-dpBTlZFkh901DHQq2xVhoj-xsZI-L0HxzzA__&Key-Pair-Id=APKAIFKFWOMXM2UMTSFA'.
> d29vzk4ow07wi7.cloudfront.net
* 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'... 26.7s
Gradle task assembleRelease failed with exit code 1
You can try to add checkReleaseBuilds property under lintOptions into your build.gradle file under the android/app folder. Like this:
android {
// Something else about compileSdkVersion, etc.
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
}
I tried to switch to stable, but another problem occurred, so I deleted the flutter SDK and download it again, now it is working fine.

Flutter: Build Error: Execution failed for task ':app:processDebugResources'

Everything was working fine before upgrading flutter to v1.17.3,
Already tried:
flutter clean
And
flutter downgrade
Error that I'm getting (Build Fail):
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\Shamuvel\Desktop\App Development\PROJECTS\Grocery Store\groci\android\Store\groci\android\app\src\main\AndroidManifest.xml:8:5-47:19: AAPT: error: attribute android:requestLegacyExternalStorage not found.
* 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 1m 27s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin path_provider...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'path_provider'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* 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: The plugin path_provider could not be built due to the issue above.
gradle.properties file:
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
Solutions Appreciated
Thanks!
Finally, switching compileSdkVersion & targetSdkVersion from 28 to 29 in android/app/build.gradle file worked.
Check these solutions as well, might help you:-
AAPT: error: attribute android:requestLegacyExternalStorage not found
Flutter: Debug build successful but release gives error
Go to File->Project Structure->Project->Project SDK
and select the latest SDK.
I am a rookie in flutter app development and faced this problem in the very first app I was building.
Fix it with remove android:networkSecurityConfig="#xml/network_security_config" from android manifest.