Flutter camera 0.8.1 make error in gradle build - android

After I updated the camera plugin in my project to the latest version camera 0.8.1 It causes an error when I want to compile and build on the Android platform.
I tried to change the Gradle version to fix this problem, but I couldn't fix this problem.
I provided all of my log and important files here, please help me to fix my problem, if you have any example which shows the usage of the latest camera plugin or something else, please don't hesitate to add your answer...
1.build.gradle(app) :
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 30
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 "ir.taleb.test_camera"
minSdkVersion 21
targetSdkVersion 30
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"
}
2.build.gradle(project) :
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
3.pubspec.yaml :
name: test_camera
description: A new Flutter application.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
camera: ^0.8.1
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
4.flutter doctor --verbose :
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.2.3 20D91 darwin-x64, locale
en-US)
• Flutter version 2.0.6 at /Users/taleb/Developer/flutter
• Framework revision 1d9032c7e1 (6 days ago), 2021-04-29 17:37:58 -0700
• Engine revision 05e680e202
• Dart version 2.12.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/taleb/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /Users/taleb/Library/Android/sdk
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS
development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with
is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods.
To re-install see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 45.1.2
• Dart plugin version 193.7547
[✓] Connected device (3 available)
• SM A107F (mobile) • R9AM905ZREJ • android-arm • Android 10 (API 29)
• macOS (desktop) • macos • darwin-x64 • macOS 11.2.3 20D91
darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome
90.0.4430.93
! Doctor found issues in 1 category.
5.Error LOG:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':camera:extractDebugAnnotations'.
> Could not resolve all files for configuration ':camera:lintClassPath'.
> Could not find lint-gradle-27.1.0.jar (com.android.tools.lint:lint-gradle:27.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle/27.1.0/lint-gradle-27.1.0.jar
> Could not find lint-27.1.0.jar (com.android.tools.lint:lint:27.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint/27.1.0/lint-27.1.0.jar
> Could not find lint-checks-27.1.0.jar (com.android.tools.lint:lint-checks:27.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-checks/27.1.0/lint-checks-27.1.0.jar
> Could not find lint-api-27.1.0.jar (com.android.tools.lint:lint-api:27.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-api/27.1.0/lint-api-27.1.0.jar
> Could not find intellij-core-27.1.0.jar (com.android.tools.external.com-intellij:intellij-core:27.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/27.1.0/intellij-core-27.1.0.jar
> Could not find kotlin-compiler-27.1.0.jar (com.android.tools.external.com-intellij:kotlin-compiler:27.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/27.1.0/kotlin-compiler-27.1.0.jar
> Could not find uast-27.1.0.jar (com.android.tools.external.org-jetbrains:uast:27.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/external/org-jetbrains/uast/27.1.0/uast-27.1.0.jar
> Could not find aapt2-proto-4.1.0-alpha01-6193524.jar (com.android.tools.build:aapt2-proto:4.1.0-alpha01-6193524).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2-proto/4.1.0-alpha01-6193524/aapt2-proto-4.1.0-alpha01-6193524.jar
* 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 37s
Exception: Gradle task assembleDebug failed with exit code 1

Related

Execution failed for task ':app:compileFlutterBuildDebug' flutter geolocator error

So I was building this app where I want to get the current location for this I used the package geolocator from flutter link -> https://pub.dev/packages/geolocator
Before I used this package my app worked fine but after I constantly get this error:
FAILURE: Build failed with an exception.
* Where:
Script 'D:\School\Academiejaar 3\Semester 1\Mobile Applications\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\School\Academiejaar 3\Semester 1\Mobile Applications\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 12s
Running Gradle task 'assembleDebug'... 14.7s
Exception: Gradle task assembleDebug failed with exit code 1
My pubspec.yaml looks lik this:
name: assistly
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: '>=2.18.1 <3.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
provider: ^6.0.3
flutter_svg: ^0.18.0
vibration: ^1.7.5
highlight_text: ^0.7.2
avatar_glow: ^1.2.0
geolocator: ^9.0.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/icons/
- assets/images/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
The error is concerning the package: geolocator: ^9.0.2
my build.gradle looks like this:
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 33
ndkVersion flutter.ndkVersion
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.example.assistly"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
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
}
}
}
configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-location:20.0.0'
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
this is the output of flutter doctor -v:
[√] Flutter (Channel stable, 3.3.3, on Microsoft Windows [Version 10.0.22000.978], locale en-GB)
• Flutter version 3.3.3 on channel stable at D:\School\Academiejaar 3\Semester 1\Mobile Applications\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 18a827f393 (5 days ago), 2022-09-28 10:03:14 -0700
• Engine revision 5c984c26eb
• Dart version 2.18.2
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\david\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Users\david\AppData\Local\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.6)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.0.32126.317
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[√] IntelliJ IDEA Ultimate Edition (version 2021.2)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2020.2.2
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] VS Code (version 1.71.2)
• VS Code at C:\Users\david\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.48.0
[√] Connected device (4 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.978]
• Chrome (web) • chrome • web-javascript • Google Chrome 105.0.5195.54
• Edge (web) • edge • web-javascript • Microsoft Edge 105.0.1343.53
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I have tried almost everything I found on stackoverflow, github, ...
such ass flutter clean
flutter pub get
I have tried rebuilding my gradle also downgrading flutter
All help is very welcome and I look forward to what you all find
If you need more information please let me know
I also had this kind of issue. Mine was with awesome_notifications after I had upgraded flutter.
I had to swap it out for local_notifications. Try replacing geolocator.

Flutter: FAILURE: Build failed with an exception, execution failed for task ':app:mergeReleaseJavaResource'

flutter build apk is not working due to this error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeReleaseJavaResource'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
invalid stream header: 00000000
android/build.gradle
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.3.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
adroid/app/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 FileNotFoundException("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: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 32
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
disable "Instantiatable"
checkReleaseBuilds false
abortOnError false
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.mobilemaster.foodbazarapp"
minSdkVersion 21
targetSdkVersion 32
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"
implementation platform('com.google.firebase:firebase-bom:29.3.1')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.google.firebase:firebase-storage'
implementation 'com.google.firebase:firebase-auth'
}
flutter doctor -v
[√] Flutter (Channel beta, 3.1.0-9.0.pre, on Microsoft Windows [Version 10.0.19043.1586], locale en-US)
• Flutter version 3.1.0-9.0.pre at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f28e570c8c (9 days ago), 2022-06-14 13:39:33 -0500
• Engine revision 74ee6b5afd
• Dart version 2.18.0 (build 2.18.0-165.1.beta)
• DevTools version 2.14.0
Checking Android licenses is taking an unexpectedly long time...[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2)
• Android SDK at C:\Users\OSAMA\AppData\Local\Android\sdk
• Platform android-32, build-tools 33.0.0-rc2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.6)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.0.32126.317
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2021.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822)
[√] IntelliJ IDEA Community Edition (version 2020.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.2
• Flutter plugin version 65.2.1
• Dart plugin version 203.8452
[√] VS Code (version 1.54.3)
• VS Code at C:\Users\OSAMA\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.42.0
[√] VS Code, 64-bit edition (version 1.68.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.42.0
[√] Connected device (4 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 32) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19043.1586]
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.53
• Edge (web) • edge • web-javascript • Microsoft Edge 102.0.1245.44
[√] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!

Flutter error : Could not resolve com.google.android.gms:play-services-location:16.+, Status code 502 [duplicate]

This question already has answers here:
Could not GET 'play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
(19 answers)
Closed 1 year ago.
Looks like Bintray library is down and I am not able to build my app. I tried a lot of solutions but none them worked.
A similar github issue is there which is already closed without any proper help.
Github link: https://github.com/flutter/flutter/issues/94400
This is the error I am getting :
Launching lib\main.dart on sdk gphone x86 arm in debug mode...
Running Gradle task 'assembleDebug'...
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 resolve com.google.android.gms:play-services-location:16.+.
Required by:
project :app > project :location
> Failed to list versions for com.google.android.gms:play-services-location.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-location/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
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 10s
Exception: Gradle task assembleDebug failed with exit code 1
android\build.gradle
buildscript {
repositories {
google()
mavenCentral()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
// jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
// jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
** flutter doctor -v **
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19044.1348], locale en-US)
• Flutter version 2.2.3 at C:\Users\PC\Documents\src\flutter
• Framework revision f4abaa0735 (5 months ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\PC\AppData\Local\Android\sdk
• Platform android-31, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• android-studio-dir = C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] VS Code (version 1.62.3)
• VS Code at C:\Users\PC\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.25.0
[√] Connected device (3 available)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.93
• Edge (web) • edge • web-javascript • Microsoft Edge 96.0.1054.43
• No issues found!
All my codes were right, the only problem was the location package which I replaced with geolocator package. Now it's working fine.
Only change!!
api 'com.google.android.gms:play-services-location:16.+'
to
api 'com.google.android.gms:play-services-location:16.0.0'

Flutter retuns error compiling hello world app

I am trying to run the "hello world" app that is generated when you create a new app. This is error that I keep getting when I try to run it in Visual Studio Code:
* What went wrong:
A problem was found with the configuration of task ':app:processDebugManifest' (type 'ProcessMultiApkApplicationManifest').
> File 'G:\Projects\flutter\brew_crew4\build\app\intermediates\merged_manifest\debug\out\AndroidManifest.xml' specified for property 'mainMergedManifest' does not exist.
* 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 3m 39s
Exception: Gradle task assembleDebug failed with exit code 1
I'm using JDK 1.8.291 and Gradle 7.0
I'm running the latest verion of Flutter as of the date of this post (2.2.3). Here is the output of "flutter doctor". There are no issues whatosever! On my Mac that has the saem version of Gradle and JDK, I can run flutter apps without problems!
• Flutter version 2.2.3 at d:\WebProjects\utils\flutter
• Framework revision f4abaa0735 (7 days ago), 2021-07-01 12:46:11 -0700
• Engine revision 241c87ad80
• Dart version 2.13.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at D:\Android\Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = D:\Android\Sdk
• Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.4)
• Visual Studio at g:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.9.31205.134
• Windows 10 SDK version 10.0.19041.0
[✓] Android Studio
• Android Studio at D:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• android-studio-dir = D:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[✓] VS Code (version 1.57.1)
• VS Code at C:\Users\User\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.24.0
[✓] Connected device (4 available)
• Android SDK built for x86 64 (mobile) • emulator-5554 • android-x64 • Android 10 (API 29) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version
10.0.19043.1052]
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.124
• Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.64
• No issues found!
I have tried reinstalling the JDK and Android Studio twice.
UPDATE: This is the contents of my build.gradle file:
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Any help greatly appreciated!
SOLVED: Apparently, starting from Gradle 6.5, it stopped working well on drives formatted as exFAT. If you must have your project on an exFAT partitioned drive, downgrade the gradle plugin in build.gradle to 4.0.2:
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
and downgrade the gradle version in gradle.properties to 6.4.1:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip

Flutter:gradle build failed with error "A problem occurred evaluating root project 'android' > A problem occurred configuring project ':app'."

My flutter app runs fine on the emulator, runs fine on my android when connected via USB, but crashes before opening when updated from the play store. Does the same to everyone else that has tried the update. So I thought I would try rebuilding as apk and install from firebase distribution.
flutter build works fine if i run as appbundle, or apk but only fails on apk --split-per-abi.
I am not sure if this error has to do with why it's crashing or if it's a new problem.
Here is the error I get when running flutter build -v apk --split-per-abi
FAILURE: Build failed with an exception.
[ +1 ms] * Where:
[ ] Script
'/Users/me/development/flutter-3/packages/flutter_tools/gradle/flutter.gradle' line: 646
[ ] * What went wrong:
[ ] A problem occurred evaluating root project 'android'.
[ ] > A problem occurred configuring project ':app'.
[ +1 ms] > The value for this property cannot be changed any further.
[ ] * 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
I seem to keep running into other issues related to this being caused by the gradle version or maybe google services version. I've tried several different versions. Currently using https://services.gradle.org/distributions/gradle-6.5-all.zip and
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.google.gms:google-services:4.1.0'
I also checked the file in the error message, line 646 contains:
abiVersionCode * 1000 + variant.versionCode
I've run flutter clean and here is my flutter doctor -v output:
[✓] Flutter (Channel master, 1.24.0-4.0.pre.167, on Mac OS X 10.15.6 19G2021 darwin-x64, locale en-US)
• Flutter version 1.24.0-4.0.pre.167 at /Users/me/development/flutter-3
• Framework revision 22724370cb (54 minutes ago), 2020-10-30 11:00:24 -0700
• Engine revision 99cc50dfff
• Dart version 2.11.0 (build 2.11.0-266.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/me/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.3.1, Build version 11C504
• CocoaPods version 1.9.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] Android Studio (version 3.5)
• Android Studio at /Users/me/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.5900203/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] VS Code (version 1.46.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.12.2
[✓] Connected device (2 available)
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.111
• No issues found!
Change the version of gradle on android/build.gradle file to 3.5.0.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
...
classpath 'com.android.tools.build:gradle:3.5.0' // Use this version
}
}
On android/gradle/wrapper/gradle-wrapper.properties, your distributionUrl should also have the following gradle version.
gradle-5.6.2-all.zip
so that you won't run into any other issues.
Finally, run these commands
rm -rf android/.gradle
rm -rf $HOME/.gradle # This is for Mac users
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
It should work like a charm! And update Gradle later on when things get little matured and stable.
android {
compileSdkVersion 30
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.test_flutter"
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
}
}
}

Categories

Resources