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
Related
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'
I am using the latest flutter stable version , flutter doctor -v as below:
[✓] Flutter (Channel stable, 2.2.2, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-IN)
• Flutter version 2.2.2 at /Users/daydreamers/Documents/development/flutter
• Framework revision d79295af24 (2 weeks ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/daydreamers/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Users/daydreamers/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.1
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 4.2)
• 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 11.0.8+10-b944.6916264)
[✓] VS Code (version 1.57.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.23.0
[✓] Connected device (1 available)
I am having Kotlin code for Android and Kotlin version is
ext.kotlin_version = '1.5.20'
I have this in my dependencies :
classpath 'com.android.tools.build:gradle:4.2.1'
I get an error when running flutter run --release, but flutter run works fine.
Exception: Unsupported Android Plugin version: 4.2.1.
I have tried other Answers from SO like updating the JVM version for Kotlin target VM (I set it to 11 from 8) .
I also have distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip in gradle-wrapper.properties.
Any help is greatly appreciated.
See whether there is something like below in your app build.gradle (app/src/build.gradle)
productFlavors {
app_dev {
dimension "version"
applicationIdSuffix ".dev"
}
app_stg {
signingConfig signingConfigs.debug
dimension "version"
applicationIdSuffix ".stg"
}
app_prod {
signingConfig signingConfigs.release
dimension "version"
}
}
If it does have something like that, then you need to go to
Run -> Edit Configuration -> Pick your main.dart on left side -> Inside 'Build flavor' put "app_dev" inside the textbox (The string can be anything and it depends on what's inside your productFlavors { ... })
This helped me solve my issue.
I had a similar problem when building with flutter build apk --flavor my_flavor.
I had configured ABI splits in my app build.gradle, and removing them solved the issue since they weren't necessary in my case.
Since yesterday, the Flutter project stopped building for me.
It gives me this error
Running "flutter pub get" in promotyflutter...
Launching lib/main_prod.dart on Redmi Note 8 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all dependencies for configuration ':app:debugCompileClasspath'.
> Problems reading data from Binary store in /tmp/gradle5564899897575971656.bin offset 447048 exists? true
* 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 29s
Exception: Gradle task assembleDebug failed with exit code 1
I have tried many things but nothing has worked so far:
flutter clean, deleted pubspec.lock and flutter pub cache repair to get rid of cache and reinstall packages but no luck :(
Flutter downgrade, got the same error
Fresh reinstall of flutter, same thing
Fresh git clone of the project and tried running from the prod branch but, nope.
Tried putting org.gradle.parallel=false in gradle settings. No luck :(
I hadn't faced such issues before. In the rare case, flutter clean used to do the trick. Any ideas?
This is the output of flutter doctor -v
[✓] Flutter (Channel stable, 2.2.1, on Linux, locale en_US.UTF-8)
• Flutter version 2.2.1 at /home/bipin/snap/flutter/common/flutter
• Framework revision 02c026b03c (6 weeks ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /home/bipin/Android/Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_SDK_ROOT = /home/bipin/Android/Sdk
• Java binary at: /opt/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Android Studio (version 4.1)
• Android Studio at /opt/android-studio
• Flutter plugin version 57.0.1
• Dart plugin version 201.9380
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3)
• IntelliJ at /opt/idea-IU-203.7717.56
• 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.57.1)
• VS Code at /usr/share/code
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• Redmi Note 8 (mobile) • 169612f4 • android-arm64 • Android 10 (API 29)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114
• No issues found!
This thing worked for me!.
distributionUrl=https://services.gradle.org/distributions/gradle-6.7-all.zip
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.
}
}
}
I'm facing an error when i try to run a flutter project in android studio or in command line with flutter run
it gives me this error
Exception in thread "main" java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:851)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
at sun.net.www.protocol.http.HttpURLConnection.doTunneling(HttpURLConnection.java:2055)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:183)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.wrapper.Install$1.call(Install.java:61)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:128)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Finished with error: Gradle task assembleDebug failed with exit code 1
the output of flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.9, on Microsoft Windows [Version 10.0.17134.1425], locale en-US)
• Flutter version 1.12.13+hotfix.9 at C:\src\flutter
• Framework revision f139b11009 (5 weeks ago), 2020-03-30 13:57:30 -0700
• Engine revision af51afceb8
• Dart version 2.7.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\win10\AppData\Local\Android\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = C:\Users\win10\AppData\Local\Android\android-sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code, 64-bit edition (version 1.34.0)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.2.0
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
• No issues found!
PS:
and i had another issue a while back so i changed flutter.gradle file like this
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
}
It seems your Gradle files are damaged.
Here's what you need to do:
open $HOME/.gradle/wrapper/dists and delete gralde-xxx-all . then execute command: flutter run again.
More info here.
Go into your Project folder and in the
gradle
wrapper
gradle-wrapper
change the number from:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
I'm gonna say exactly how I overcome this issue .some steps might not be necessary but i did all of this :
unistall flutter and android studio
install the lastest version of both (android studio and flutter )
then add
maven {
url 'http://download.flutter.io'
}
in your build.gradle file
then change compile and target sdk version to 29 (just find them and replace 29 with 28 )
C:\Users\$USER\AndroidStudioProjects\$projectname\android\app\build.gradle
like this
compileSdkVersion 29
targetSdkVersion 29
this is how it got solved for me . i hope it works for you guys too .