I recently upgraded Android Studio to 4.0. I had initially delayed the upgrade because there was a communication that the recent version is not compatible with Firebase and Kotlin. Now after the upgradation I had to reconnect android studio to Firebase and the dependencies were set up again. What I find is that the recent Firebase updates has specific libraries for Kotlin. For instance in Realtime Database we have implementation 'com.google.firebase:firebase-database-ktx:19.3.1' as against implementation 'com.google.firebase:firebase-database:19.3.1' for Java.
However, the Firebase assistant in Android Studio implements the java versions of the library. Is this a bug? I am confused. Do I change manually to the Kotlin specific libraries?
ktx librarys are extensions librarys that have kotlin syntax. Thats mostly it.
ktx has kotlin syntax and the normal ones have java syntax.
You can read more here. https://developer.android.com/kotlin/ktx
Related
I am using firebase in my android app, and I had included several firebase client libraries in my build.gradle, each by its own version.
When a new version of each library was available, Android Studio suggested me to upgrade the version to the newer version by highlighting the dependency in yellow.
I recently updated my build.gradle to use Firebase BOM, so that the BOM picks the compatible versions of the each firebase library, so I don't need to specify individual versions of each firebase library.
implementation platform('com.google.firebase:firebase-bom:26.1.0')
Now, Android Studio doesn't detect new versions of firebase-bom, like it did for individual firebase libraries earlier. For an example, I can see that 26.1.1 of firebase-bom is released, but Android Studio doesn't show me that.
Why is this? Is there any way to get Andriod Studio to detect new versions of firebase-bom?
Google released an updated version of Android Studio 3.5. After having updated to this version I get this warning below:
This project uses Gradle KTS build files which are not fully supported.
Some functions may be affected.
However, I believe this warning is restricted to developers who are using the Gradle’s Kotlin DSL to manage their dependencies. Instead of using groovy scripts.
Now android studio 4.0 is officially Support for Kotlin DSL script files(*.kts) so you need to update it and see the warning removed from your Event Log.
you can check below image and read from it official Document
I am new in mobile development using Java and Kotlin, I had an application in Java which I needed to start in a new project.
When creating a new project in Android Studio, I checked Use androidx.* artifacts. After coping some dependencies from my old project, I had too many errors which I fixed by going to Refactor => Migrate to AndroidX
Now I want to now what is the difference between android and androidx packages.
Thanks in advance.
Android has been building up APIs that are backward compatable and has a lot of Android Support libraries that exist in developer APIs. To clean up this mess,Android introduced androidx libraries. AndroidX is a major improvement to the original Android Support Library. Like the Support Library, AndroidX ships separately from the Android OS and provides backwards-compatibility across Android releases. AndroidX fully replaces the Support Library by providing feature parity and new libraries
You can read about androidx here https://developer.android.com/jetpack/androidx
I'm learning flutter. The "Adding Firebase to Flutter" tutorial shows to use this; "com.google.gms:google-services:3.2.1" but the latest version seems to be 4.2.0
Also, I'd like to use suitable (latest?) version of packages from https://pub.dartlang.org/packages
Such as (currently):
firebase_core 0.3.1+1 and
google_sign_in 4.0.1+1
If I just choose the latest numbers I get a lot of compilation errors.
My Questions is: where can I find the latest supports/compatible version numbers for these various components?
The only thing I have found to work is to use:"com.google.gms:google-services:3.2.1" and to just keep downgrading pub package versions numbers until the compiler errors go away. I feel like there must be a more sane way to deduce the correct version numbers to use for various components.
Anybody have any insight into this issue?
Thanks
I need to see error messages but it's probably about AndroidX. If you have to check the changelog files of your plugins (by the way it's a good practice since sometimes readme's are not updated), you will probably see
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.
google_sign_in 4.0.0 changelog
You can avoid AndroidX by using these packages listed or you can migrate to AndroidX with these instructions.
flutter create is not coming with androidx, it comes with android support libraries, but if you have Android Studio, it's easy to migrate it. In my case, I've migrated it.
I am getting this error while configuring kotlin plugin with Jack. I an using Android studio 2.3.2 currently.
Error:Kotlin Gradle plugin does not support the deprecated Jack toolchain. Disable Jack or revert to Kotlin Gradle plugin version
1.1.1.
If you are using latest IDE(3.0, preview version) it won't let you use Jack or you are using kotlin version above 1.1.1.
Jack has been deprecated because of the build time performance issue, It was mentioned in one of the session of google IO 2017. You can read this blog
In official documentation of Jack following warning is given:
The Jack toolchain is deprecated, as per this announcement. However, you may continue to use it to enable Java 8 language features until the replacement is available.
If you still want to use it, switch back you Android studio IDE to 2.3, and revert back to kotlin 1.1.1
EDIT
Kotlin by default supports Lambda expressions. If you want to use lambda expression in java with Kotlin also, you have to use Android Studio 3.0.