Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
Actual typealias 'ApplicationContext' has no corresponding expected declaration

I got this issue when trying to custom context for kotlin multiplatform

Actual typealias 'ApplicationContext' has no corresponding expected declaration
The following declaration is incompatible because modality is different:
    public final expect class ApplicationContext

androidMain

import android.app.Application

actual typealias ApplicationContext = Application

commonMain

expect class ApplicationContext

iosMain

import platform.UIKit.UIView

actual typealias ApplicationContext = UIView

enter image description here

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The expect class structure should match the class you're typealiasing to.

Android's context class is an abstract class

public abstract class Context {}

So the modality error comes from there.

You would need the expect class to be abstract as well to fix that particular error

expect abstract class ApplicationContext

Making it abstract would break modality for UIView as it's not abstract. So what you're trying to do is not possible in a straightforward manner.

You would need to think about a different strategy for what you're trying to achieve.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!