S
Supabase•2mo ago
borisgg

Issue with connecting from Android Studio

Hi, i am trying to connect to my database. I have read the guide in the supabase website and i did all the steps listed there. But when i try to initialize the Supabase client the app doesn't run. The first line of the error is the following: "org.jetbrains.kotlin.util.FileAnalysisException: While analysing C:/Users/user/AndroidStudioProjects/MyApplication/app/src/main/java/com/example/myapplication/MainActivity.kt:26:5: java.lang.IllegalArgumentException: source must not be null".
The whole output is quite long for posting it. I will be very grateful if you can give some advice!
3 Replies
Lordvickthor
Lordvickthor•2mo ago
Looks like the error is happening when initializing the Supabase client in your MainActivity.kt. I can help you debug the setup and make sure your keys, URL, and initialization code are correct. Can you share the snippet where you initialize the client (around line 26)? That will help pinpoint why source is coming up null. @borisgg
borisgg
borisggOP•2mo ago
Thank you for your help, Here is the code. Bellow the initialization i dont use the client. Thats because i just wanted to test what doesn't work and what does val supabase = createSupabaseClient( supabaseUrl = "myurl", supabaseKey = "myanonkey" ) { install(Postgrest) } class MainActivity : ComponentActivity() { (line 26) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) enableEdgeToEdge() setContent { MyApplicationTheme { Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding -> Greeting( name = "Android", modifier = Modifier.padding(innerPadding) ) } } } } } @Lordvickthor 👑
Hieu Vu
Hieu Vu•5w ago
Hi please share your dependencies in your gradle file. Make sure you added required supabase deps and also ktor core

Did you find this page helpful?