Flutter:The plugin firebase_auth could not be built due to the issue above - firebase

I just use firebase_auth package to send me code by phone Number. it work fine in debug mode but when I try to get apk it show me this error. can anyone help me please?
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sms:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:\Users\Mohammad Asef\.gradle\caches\transforms-2\files-2.1\8014592fef965c457f4d96ed4583a915\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\Mohammad Asef\.gradle\caches\transforms-2\files-2.1\8014592fef965c457f4d96ed4583a915\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex 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 3m 52s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 233.5s (!)
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 firebase_auth...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 0.3s
Exception in thread "main" java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.zip.ZipFile.<init>(ZipFile.java:169)
at org.gradle.wrapper.Install.unzip(Install.java:214)
at org.gradle.wrapper.Install.access$600(Install.java:27)
at org.gradle.wrapper.Install$1.call(Install.java:74)
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)
The plugin firebase_auth could not be built due to the issue above.

firebase_auth is using AndroidX libraries, but your flutter project is still using the old android support library. To solve this upgrade to flutter latest version. From the docs:
How do I know if my project is using AndroidX?
Starting from Flutter v1.12.13, new projects created with flutter create -t <project-type> use AndroidX by default.
Projects created prior to this Flutter version must not depend on any old build artifact or old Support Library class.
In an app or module project, the file android/gradle.properties or .android/gradle.properties must contain:
android.useAndroidX=true
android.enableJetifier=true
https://flutter.dev/docs/development/androidx-migration

I solved it by adding firebase_analytics dependency in pubspec, then adding manually string value of default_notification_channel_id in android resource just like below
<string name="default_notification_channel_id" translatable="false">fcm_default_channel</string>

Related

flutter firebase facebook login not working on android due to a build.gradle problem

it is working fine on iOS but facing this issue on android
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':firebase_auth:generateDebugRFile'.
Could not resolve all files for configuration ':firebase_auth:debugCompileClasspath'.
Could not find com.facebook.android:facebook-login:[8.1).
Required by:
project :firebase_auth
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 20s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
The version given by the facebook documentation doesn't work for me either.
That's the version i am actually using:
implementation 'com.facebook.android:facebook-login:[8,9)'
Anyway, if it doesn't solve your problem, try to give more information like, the plugin you are using for the facebook authentication, its version, and the firebase_auth and firebase_core version of the plugin you are using
It just worked with me when i switched to windows (don't know how ) and the error still show on Mac OS after trying all available solutions

flutter sqllite not woring

I m writing a flutter application and i m trying to learn using SQLite, as per document i added package in dependencies and run command to get it .
it gives error while compiling
dependencies:
flutter:
sdk: flutter
sqflite: ^1.1.5
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
i m expecting application to run but it gives error
PS D:\my\flutter\snapexpense_new> flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 1.2s
Resolving dependencies... 3.8s
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':sqflite:lintClassPath'.
> Could not download kotlin-compiler.jar (com.android.tools.external.com-intellij:kotlin-compiler:26.2.1)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/kotlin-compiler/26.2.1/kotlin-compiler-26.2.1.jar'.
> Connection reset
* 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
Running Gradle task 'assembleDebug'... Done 120.2s (!)
Gradle task assembleDebug failed with exit code 1
The day I was also with this problem but fortunately I settled after a lot of research time.
First step
you must download kotlin-compiler.jar
Second step
Open your project flutter go to the folder that is in the image above and paste the kotlin-compiler.jar
After all this done open your flutter project and update your dependencies, and when you finish back to run application.
For me it worked hope it works for you too.

Getting error with firebase_messaging plugin

I'm adding firebase_messaging plugin to my project, the previous version had firebase_messaging and was working fine. I'm shifting my project from using flutter_webview_plugin to using webview_flutter, so I changed my code accordingly but I started getting errors. I created new project and the same error is thrown, but when I removed firebase_messaging it started working.
This is the error:-
D8: Program type already present: android.support.v4.app.INotificationSideChannel
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/2.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/3.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/4.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/5.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/7.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/10.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/11.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/12.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/13.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/14.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/37.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/40.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/46.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/49.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/52.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/55.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/58.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/61.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/64.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/67.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/70.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/73.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/76.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/79.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/82.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/85.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/88.jar, /Users/KiranMenon/Desktop/tydy_mobile/build/app/intermediates/transforms/dexBuilder/debug/91.jar
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.app.INotificationSideChannel
* 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 11s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See **************** for more information on the problem and how to fix it.
*******************************************************************************************
Finished with error: Gradle task assembleDebug failed with exit code 1
Check this issue on github about that. Also, if you are using the latest plugins you should migrate your project to be compatible with AndroidX. And make sure your compileSdkVersion is compatible with those plugins. ps: flutter clean it after you try those things.

Execution failed for task ':firebase_auth:compileDebugJavaWithJavac'

After upgrading firebase_auth from earlier version to ^0.8.0+1 generates error for me.
Here is error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':firebase_auth:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
According to the Changelog, you have to perform a migration in the Android project to AndroidX.
The details of the changes required are here.
See CHANGELOG:
0.8.0
Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.
Firstly set the compileSdkVersion to 28 in the android/app/build.gradle file.
Secondly add the following to your android/gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true

Ionic blank project's build failed after adding mfp-push plugin

create an blank ionic project and added mfp and mfp-push plugins. Tried to build and got this error:
BUILD FAILED in 41s
Error: cmd: Command failed with exit code 1 Error output:
C:\Users\saikmeda\TestFbSdk\platforms\android\app\src\main\java\com\ibm\mobilefirstplatform\clientsdk\cordovaplugins\push\CDVMFPPush.java:100: error: cannot access FirebaseInstanceIdService
MFPPush.getInstance().initialize(this.cordova.getActivity().getApplicationContext(), timeout);
^
class file for com.google.firebase.iid.FirebaseInstanceIdService not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 41s
The latest MFP 8.0 client side iFix for Android has been modified to work with FCM completely. The error message you see is coming because there are some changes needed in your Android project - specifically around removing GCM classes and modifying for FCM.
Follow the instructions in the link to get your project working:
http://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/notifications/handling-push-notifications/android/#migrate-to-fcm
Now, all this is required only if you use MFP's push feature. If you do not , you can remove cordova-plugin-mfp-push plugin from your project and rebuild it.

Resources