FLUTTER: java.io.StreamCorruptedException: File format not recognised - firebase

One moment the project was running fine but when i tried to debug the code again i got this error.
Launching lib\main.dart on SM A515F in debug mode... lib\main.dart:1
FAILURE: Build failed with an exception.
* What went wrong:
java.io.StreamCorruptedException: File format not recognised
* 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

Can you run
flutter clean
followed by
flutter pub get
then
flutter run

Related

Unable to build apk after adding firebase-analytics[Ionic, Cordova]

I am getting error when I try to build apk after adding firebase-analytics. It is showing error in console is
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\sampleproject\platforms\android\app\build.gradle' line: 428
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin [id 'com.google.gms.google-services']
> Cannot add extension with name 'googleServices', as there is an extension already registered with that name.
* 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 6s
Command failed with exit code 1: D:\sampleproject\platforms\android\gradlew cdvBuildDebug -b D:\sampleproject\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
The file googleservices is already present in my project before. As I am using Firebase authentication before in my project. Now the issue is, I can't edit the Gradle file as I am using Cordova to build the Apk.
I also gone through other stackoverflow question and answers, I commented out
apply plugin: com.google.gms.googleservices.GoogleServicesPlugin
in gradle but this is not the proper way to solve this problem.
Below this I am mentioning all the extensions I had in my project.
"#ionic-native/firebase-analytics": "^5.36.0",
"#ionic-native/google-plus": "^5.28.0",
"firebase": "^7.19.1",
"google-auth-library": "^6.0.6",
"cordova-plugin-firebase-analytics": "^6.1.0",
"cordova-plugin-firebase-lib": "^5.1.1",
For more clarification I attached the screenshot.
Thank you in advance.

Flutter: Execution failed for task ':firebase_core:compileDebugJavaWithJavac'

I would like to ask some help regarding flutter.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':firebase_core:compileDebugJavaWithJavac'.
> Could not create service of type DefaultGeneralCompileCaches using GradleScopeCompileServices.createGeneralCompileCaches().
> Unexpected lock protocol found in lock file. Expected 3, found 0.
* 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
This is the error I am getting , I've never seen anything like this before. Other apps runs perfectly fine so there's no value in adding flutter doctor if you want to see some other code lemme know down in the comment.
It seems like you are facing this issue when the android gradle build is running. As per the error output, this might get you back on track.
Try deleting the gradle cache located under
Windows:
C:\Users\user\.gradle
Mac/Linux:
/Users/prabhath/.gradle
folder and rerun the build.
Hope this will solve your problem.

Execution failed for task ':app:mergeDebugJavaResource'. - Gradle Task assemble

so I was trying to run my flutter project and then I got this error :
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> java.nio.file.FileSystemException: C:\Users\ASUS\Desktop\Programmin\Flutter\app_with_firebase\build\app\intermediates\merged_java_res\debug\out.jar: The process cannot access the file because it is being used by another process.
* 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 3s
Exception: Gradle task assembleDebug failed with exit code 1
I tried to do : File > Invalidate Chaches/Restart in Android studio, but it won't solve the problem. I also tried to do flutter clean, then flutter run, but It still shows me the same error.
I have no idea what to do now, any help is appreciated.
Thank you !
I did a bit more digging with SysInternals and jps and it turns out that the Kotlin Language Server wasn't releasing the lock on the build folder. For me, uninstalling the VS Code fwcd Kotlin extension (and replacing with a different Kotlin language extension, if required) was enough to fix the issue.
On Android Studio, all I can suggest is disabling/uninstalling the Kotlin plugin and seeing if that fixes it for you.

Flutter - Firebase Analytics Dependency Error

I have been building an app, and I wanted analytics in that so I added firebase_analytics: ^6.0.0 as a dependency. But whenever I try to run the app in debug mode, I get this error
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> File 'com.android.builder.files.ZipCentralDirectory#479a9b01' was deleted, but previous version not found in cache
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> File 'com.android.builder.files.ZipCentralDirectory#3cbd23b5' was deleted, but previous version not found in cache
* 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.
But if I remove it, it runs in debug mode without any problems.
So far, I ran flutter clean and then flutter pub get, and also tried Invalidating the cache and restarting, but neither of those worked.
Here's my pubspec.yaml excluding firebase_analytics
cupertino_icons: ^0.1.3
firebase_core: ^0.5.0
firebase_auth: ^0.18.0+1
cloud_firestore: ^0.14.0+2
fluttertoast: ^7.1.1
intl_phone_number_input: ^0.5.1

On running the emulator getting this error: Cause: invalid type code: 1D

Recently i installed android studio, and when i run the app for the first time it ran without any error but now, when i run it, it has given the error i.e.
Cause: invalid type code: 1D
and
Executing tasks: [:app:assembleDebug] in project /home/dell/AndroidStudioProjects/disha
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* 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 95ms
Please help.
To resolve this error please make the changes below:
Install Java SDK version: 14 or above.
JDK Download link: https://www.oracle.com/java/technologies/javase-jdk14-downloads.html
And in gradle-wrapper.properties please use grade version 6.3 or above.

Resources