Compose into existing project, No virtual method Int

PressRex profile image
by PressRex
Compose into existing project, No virtual method Int

Cant make compose run in existing kotlin/native project for month now, trying to set default Greeting example to splash instead of its ui, cant make it:

java.lang.NoSuchMethodError: No virtual method Int$class-SplashActivity()I in class Lcom/a/b/c/activity/LiveLiterals$SplashActivityKt; or its super classes (declaration of 'a.b.c.ui.activity.LiveLiterals$SplashActivityKt' appears in /data/app/a.b.c.develop-7Zjdfjfy762lPctajg==/base.apk!classes29.dex)
    at a.b.c.ui.activity.SplashActivity.<clinit>
    at java.lang.Class.newInstance(Native Method)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6494)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

Yes, crash before activity start.

kotlin 1.5.21

compose_version = 1.0.2

mTargetSdkVersion=30(I'm tired of merging manifests every sync, so no 31 until I'l run it all)

mCompileSdkVersion=31

mMinSdkVersion=21

project level build.gradle:

    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "com.android.tools.build:gradle:7.1.0-alpha12"
    classpath "gradle.plugin.com.wiredforcode:gradle-spawn-plugin:0.8.2"
    classpath "com.google.gms:google-services:4.3.10"
    classpath "com.google.firebase:firebase-crashlytics-gradle:2.7.1"

android module build.gradle(not whole file, its existing project):

implementation "com.android.support:recyclerview-v7:28.0.0"
implementation "com.android.support.constraint:constraint-layout:2.0.4"
implementation "com.android.support:cardview-v7:28.0.0"

implementation "androidx.activity:activity-ktx:1.4.0-alpha02"
implementation "androidx.appcompat:appcompat:1.4.0-alpha03"
implementation "com.google.accompanist:accompanist-appcompat-theme:0.18.0"
implementation "com.google.android.material:material:1.5.0-alpha03"

implementation "androidx.navigation:navigation-fragment-ktx:2.4.0-alpha09"
implementation "androidx.navigation:navigation-compose:2.4.0-alpha09"

implementation 'androidx.core:core-ktx:1.7.0-beta01'
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0-beta01'

implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.activity:activity-compose:1.4.0-alpha02'

implementation "androidx.tracing:tracing-ktx:1.0.0"

implementation "androidx.multidex:multidex:2.0.1"


implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"

also contains pushwoosh, appsflyer, crashlytics, junit tests(does impact compose libs?)

EDIT: pushwoosh, appsflyer, crashlytics was removed for sake of test, fixed nothing.

Downgrade to compose 1.0.1 and stable androidx did nothing

Source: View source

PressRex profile image
by PressRex

Subscribe to New Posts

Lorem ultrices malesuada sapien amet pulvinar quis. Feugiat etiam ullamcorper pharetra vitae nibh enim vel.

Success! Now Check Your Email

To complete Subscribe, click the confirmation link in your inbox. If it doesn’t arrive within 3 minutes, check your spam folder.

Ok, Thanks

Read More