When I update the com.google.firebase:firebase-auth-ktx library to a version higher than 21.0.1 I get the following warning:
Kotlin library {0} was compiled with a newer Kotlin compiler and can't be read. Please update Kotlin plugin.
I already tried to update the Kotlin plugin in tools->Kotlin->Configure Kotlin Plugin Updates, but it didn't work. I have the latest version of Kotlin plugin and Android Studio installed. How can I solve this problem, or just hide the warning?
You can try to update the Kotlin version in your build.gradle Project level file, you will find a "plugins" ids, try to set it to 1.6.21 (I have it on 1.6.10):
plugins {
id 'com.android.application' version '7.1.1' apply false
id 'com.android.library' version '7.1.1' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
Related
I'm using flutter fire and already did the console configuration, but everytime I try to run the code with an firebase_auth import I got this error.
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_auth_platform_interface-6.2.0/lib/src/method_channel/utils/exception.dart:12:7: Error: A non-null value must be returned since the return type 'Never' doesn't allow null.
The error message was added from dart 2.16, i.e from flutter 2.10, so the primary solution will be to upgrade your flutter version, which will also upgrade dart version.
So I ran into this problem recently while using firebase_storage
What I did to solve the problem was... (I was on flutter 2.5 and dart 2.14).
Upgrade flutter and dart version: Into terminal, run flutter upgrade or in my case, flutter upgrade --force, since flutter upgrade was giving me some issues.
Then I added the latest version of the dependencies to my pubspec (firebase_storage_10.2.0)
At this stage, running the app will likely throw an error about unsupported compileSDKVersion or so, and ask you to upgrade.
For that, go into your app level build.gradle file
("project"\android\app\build.gradle),
and under android, change the compileSDKVersion from it's current value to what flutter asks you to change to. in my case, it was from 30 to 31
android{
//change compile sdk version to 31 (in my case. flutter will tell you which version you should set to)
compileSdkVersion 31
}
When you run the app now, it will check for licenses for the Android SDK Package you just edited (31). it should automatically accept and install everything neccessary.
Flutter run might then fail again, with the error of an incompatible kotlin version, and that you should update or so.
To update the kotlin version, go to the project level build.gradle ("project"/android/build.gradle)
change the kotlin version here (ext.kotlin_version = '1.3.5') to the latest version which can be found Here. as of now, the latest version is 1.6.10
so this line of code now reads
ext.kotlin_version = '1.6.10'
Now you are good to go. run the app again, it might take much longer than usual, but it should work just fine.
Or at least it worked fine for me.
I also had the same error.
Try upgrading the dart version or use lower version of firebase_auth.
firebase_auth: 2.0.0
firebase_auth: 2.0.0 worked for me.
Overall Complete Solution.
Solution:
Step 1:
The solution for this error is to upgrade to new flutter version.
Open Command Prompt and run this command.
flutter upgrade
Then after upgrading to new flutter version. Open your project and test it on your phone.
If shows error to upgrade kotlin version also, then:
Step 2:
As we have upgrade to new version of flutter so we have to upgrader things also in build.gradle.
-> Go to android/build.gradle
-> change to ext.kotlin_version = '1.6.10'
For example,
In my old version i had ext.kotlin_version = '1.3.50' and now i change it to new ext.kotlin_version = '1.6.10'
Please Check here the Example in Screenshot Image
Now Today Date is: 01/3/2022
In future: if you are reading this comment, then the version number ext.kotlin_version = '1.6.10' may be different.
So For latest new version number, go to this site:
https://kotlinlang.org/docs/gradle.html#plugin-and-versions
Here is the ScreenShot for Understanding
Step: 3
-> Go to android/app/build.gradle
-> change minSdkVersion to 19
-> add multiDexEnabled true
For example,
Check here the example Screenshot
Now you can run and test the app on your phone. It will work 100 percent.
Ok so I run my program without importing firebase core, firebase auth and cloud firestore, and my code runs just fine but I register my app with firebase and it still runs fine but as soon as I import Firebase_auth, Firebase_core and cloud_Firestore... I get the following error
Note: C:\appflutter\flutter\.pub-cache\hosted\pub.dartlang.org\firebase_core-0.7.0\android\src\main\java\io\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\appflutter\flutter\.pub-cache\hosted\pub.dartlang.org\cloud_firestore-0.16.0\android\src\main\java\io\flutter\plugins\firebase\firestore\streamhandler\TransactionStreamHandler.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
D8: Cannot fit requested classes in a single dex file (# methods: 89543 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Please help me.
I was having the same problem today and I found the solution here on Github
First, get the latest versions of your dependencies from pub.dev
Current latest versions are these:
firebase_auth: ^0.20.0+1
firebase_core: ^0.7.0
Then run these 3 commands in the terminal:
$ flutter pub upgrade
$ flutter pub get
$ flutter clean
And then run your project
$ flutter run
This will hopefully help you.
Seems it is a bug in Firebase plugins: https://github.com/FirebaseExtended/flutterfire/issues/3876. However setting min SDK to 23 does not show the warning.
it worked for me to change my sdkVersion to 23:
just go to android>app>build.gradle and
change the minSdkVersion-line in defaultConfig{} to .. minSdkVersion 23
$ flutter pub get
Just Do it in your Terminal it will work
Enable multidex in android project & run again.
I am suggesting this according to the last part of the error message you've posted.
According to this guide: https://firebase.flutter.dev/docs/installation/android#enabling-multidex
However, if your minSdkVersion is set to 20 or lower, then you must use the multidex support library and make the following modifications to your app project
In android - app - build.gradel file
add - implementation 'com.android.support:multidex:1.0.3' in dependencies section
add - multiDexEnabled true in default config section enter image description here
enter image description here
Suffered the error of FlutterFirebaseCorePlugin.java uses or overrides a deprecated API. for two days.
finally solved it by changing minSdkVersion to 21 in app/build.gradle and run the app with flutter run --no-sound-null-safety.
Found that the error comes from the sound null safety implementation which grey lists all incompatible API
There are two issues here, -Xlint and multidex.
For -Xlint, #Sarib's solution worked for me and both the -Xlint errors disappeared after running flutter pub upgrade, flutter pub get and flutter clean. You can find them under Tools > Flutter in Android Studio if you are not familiar with Terminal.
For multidex, according to the Android Studio User Guide, multidex is enabled by default if your minSdkVersion is 21 or higher. While #Joshi suggests enabling multidex, I think it is simpler to update the minSdkVersion in android/app/build.gradle file to 21 or higher, rather than mess with more variables and adding more dependencies, assuming you're building an app that targets Android21 or higher.
For this error:
Note: locationInD\flutter\plugins\firebase\core\FlutterFirebaseCorePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
The solution I found was to replace this line in android/app/build.gradle:
implementation 'com.google.firebase:firebase-analytics-ktx'
with
implementation 'com.google.firebase:firebase-analytics'
For me i changed one of my implementation version from
implementation platform('com.google.firebase:firebase-bom:27.1.0') to
implementation platform('com.google.firebase:firebase-bom:26.6.0')
at the moment there are some bugs in this current version "27.1.0" and after running the application it worked
//To help someone my project needed this implementation for my ads #admob
change to minSdkVersion 24
in android/app/build.gradle
dependencies {
//add this in your dependencies
implementation "androidx.multidex:multidex:2.0.0"
}
then
$ flutter clean
$ flutter run
I had the same issue and combined two suggested fixes to get it to finally work:
minSdkVersion 21, change to 23
run "flutter pub upgrade"
= issues fixed!
To double-check what the fix was:
I also reverted back to 21 and invalidated + flutter clean and the issue appeared again. Then I changed to 23 and the warnings disappeared!
Check your minSDK, it works fine for 23
After install react-native-firebase and add module auth, showed this erro in Android Studio:
ERROR: Project with path ':#react-native-firebase_app' could not be
found in project ':#react-native-firebase_auth'.
What does this mean?
I have also faced the same issue.
After I install npm i #react-native-firebase/app the problem is solved.
You can try the following:
-Checking if firebase app was referenced in an incorrect way in MainApplication.java.
-Remove the modules and re-installing them may fix the problem sometimes.
I think you have different versions of firebase/app and firebase/auth.
Just go in 'node module/#react-native-firebase' directory and check package json of both firebase/app and firebase/auth you will see different version.
This problem can also happen if you are using #react-native-firebase#6.2.0
if you check the build.gradle of firebase/auth in version 6.2.0
dependencies {
api project(':#react-native-firebase_app')
implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}")
implementation "com.google.firebase:firebase-auth"
}
So here is a problem that it is not able to find #firebase/app
and #firebase/auth depends on #firebase/app
And in #6.3.4 which is working fine for me have build.gradle of #firebase/auth like below
so it is able to find #firebase/app
if (findProject(':#react-native-firebase_app')) {
api project(':#react-native-firebase_app')
} else if (findProject(':react-native-firebase_app')) {
api project(':react-native-firebase_app')
} else {
throw new GradleException('Could not find the react-native-firebase/app package, have you installed it?')
}
implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}")
implementation "com.google.firebase:firebase-auth"
}
run npm uni #react-native-firebase/auth
then run this simple command #react-native-firebase/auth#10.4.1
I was using "#react-native-firebase/auth": "15.1.1", and having the same problem , then i downgrade it to "#react-native-firebase/auth": "^10.4.1", and it worked.
if you have any problem installing make sure to use --legacy-peer-deps at the end , like this:
npm i #react-native-firebase/auth#10.4.1 --legacy-peer-deps
I am using two plugin with my flutter app location: ^1.4.1 and firebase_messaging: ^2.0.0
If I use single one its works fine but together
What went wrong:
Failed to capture snapshot of input files for task ':app:preDebugBuild' property 'compileManifests' during up-to-date check.
> The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
flutter clean
trying to downgrade version for both plugin
and google search
non of the above works for me.
app level build: implementation 'com.google.firebase:firebase-core:16.0.1'
project level build: classpath 'com.google.gms:google-services:4.0.1'
Thanks
:)
In your Project - Goto Android > App > build.gradle
Right after the apply plugin: 'com.google.gms.google-services' at the bottom of your build.gradle the following can be added to work around the issue.
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
It happens when I run stylefmt and stylefmt-loader through webpack with stylelint-config-recommend
font-family-no-missing-generic-family-keyword was added in stylelint 8.3.0; if you are using the latest version of stylelint-config-recommended you will need to update your version of stylelint to 8.3.x to match.
If stylefmt installs its own stylelint you could override the subdependency with e.g. yarn's support for that or downgrade your version of stylelint-config-recommended.
stylefmt (the latest released to the moment is 6.0) uses a previous version of stylelint. In that version, that rule does not exist.
Here is the issue reported to stylefmt: https://github.com/morishitter/stylefmt/issues/334
If you are using Yarn you can force that dependency to 8.3.0 and you will fix the issue. To force it, you need to add a resolutions property in the package.json and specify the stylelint version:
"resolutions": {
"stylelint": "8.3.0"
}