Problems setting up SQLDelight - android

I'm trying to use SQLDelight in my project. Everything seems to be working alright in respect of code generation. Unfortunately I can't use the interfaces generated under /build/generated/source/sqldelight/... in my project. When I try to create a class implementing a generated model it gets underlined with the error cannot resolve symbol 'InterfaceName'.
I prepared an example project showcasing my problem here. Any help getting it to work is of course much appreciated.

You need to apply the sqldelight plugin on the app, not the project. In your application build.gradle file, right below apply plugin 'com.android.application:' put apply plugin: 'com.squareup.sqldelight'

Related

android.synthetic library isn't being recognized in android studio

In my Activity.kt class, the synthetic isn't being recognized in the import
import kotlinx.android.synthetic...
I have included the following in my build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
When trying it import, it will recognize extensions and parcel
import kotlinx.android.extensions...
import kotlinx.android.parcel...
So why is synthetic the only one not being recognized?
Other info:
I have tried invalidating caches and restarting.
I have another computer that also has this android studio project (Same gradle versions and everything). Everything works fine there.
Edit:
I understand the current way to do it is to use data binding. But this is just a project we need to sustain, not improve and upgrade. We have a custom sdk (added many years ago) in the project that is making it hard to upgrade gradle and modernize.
The project, even though synthetic is not recognized, is building and uploading fine. I just want to remove these red lines of error.
Any advice on how to start trouble shooting would be greatly appreciated.
Synthetics were deprecated and removed in the latest version of Android Studio (Chipmunk). The recommendation is to migrate to using view binding. If you cannot do that, then you'll need to use an older version of Android Studio.
Migrating to view binding from synthetics is generally straightforward, so that's the better long term solution of course, but changing the IDE version is a quick short term solution.
Even projects in maintenance mode require occasional maintenance - like dealing with deprecations.

Missing Google gradle plugins in Gradle plugin portal?

I was trying to migrate build.gradle files to use Kotlin DSL. Using the plugins block instead of apply (legacy, apparently) doesn't seem to be as straightforward as suggested. Since "com.google.firebase.appdistribution", "com.google.firebase.crashlytics", and "com.google.gms.google-services" are missing in the Gradle plugin portal (?). Can I not use them in the plugin block? I tried this but it didn't seem to work. Also, why are they missing? I still don't quite understand how this works so please bear with me.

Class not resolved when implementing custom library in Gradle Android

I have created an android library and published it in Jitpack.
Currently, my build is getting success in Jitpack. but when I add the implementation URL in my project build Gradle gets success but when I try to use library classes it does not get resolved
In the external library tab located in the project structure, it does not have the library which I have implemented so might be .jar file is not getting generated.
Help me If you have any solution or any way to identify this issue.
If I understand correctly you say that the gradle build or 'project sync' after a change in the gradle files works fine. But you cannot use any of the code from your library.
Can you verify that your library is loaded in the External Libraries?
It would be something with your repository name in it and ends with '#aar' (eg. com.github.nickname:libraryname:version#aar)
If you cannot find it, please check if your library module build.gradle has the line below somewhere at the top of the file.
apply plugin: 'com.android.library'
The issue was the Repository was private so we need to provide an authentication token. The reference link is given below
https://jitpack.io/docs/PRIVATE/

Android Realm initial setup

I would like to start using Realm for android but i having problem setting it up. i follow the instructions located at https://realm.io/docs/java/latest/#getting-started but still doesnt work.
here is my gradle(project)
here is my gradle (app)
i create a class and extend RealmObject, android studio complains and give me message "Cannot revolve symbol Realmobject". here is a snaphot of my class
my gradle are syncing up fine and there is no error while syncing but for some reason i am not able to start coding Realm object. can someone help me and tell me what i am doing wrong? im using android studio 3.1.3
the problem is that apply plugin: 'realm-android'
also needs to be added to gradle(feature) file

integrating GCM and gcm_defaultSenderId is not resolved

I am integrating GCM into my app, what i did was i have made the configuration file google-services.json and placed it inside the app folder (i am using Android Studio) the resource file is also imported and I am also including the plugin in my build.gradle of application like this
apply plugin: 'com.google.gms.google-services'
the problem is that it is still not resolved. I want to know what is wrong?
I have searched about it and i find this, i have used my project number now there is no error coming up. Is it right way to do? Someone please explain
Take a look at the gradle files of the official google example: https://github.com/googlesamples/google-services/tree/master/android/gcm
You will see you need to do two things:
add
classpath 'com.google.gms:google-services:2.0.0-beta6'
to project gradle build file and
apply plugin: 'com.google.gms.google-services'
at the bottom of module app gradle build file.

Categories

Resources