This message was deleted.
# android
s
This message was deleted.
n
What version of AGP, KGP and Compose are you using? Have you checked that they are all compatible with each other?
n
Tired with multiple versions. Currently using
Copy code
kotlinCompilerExtensionVersion = "1.3.2"
kotlin_version = '1.7.20'
gradle_version = '7.4.0'
api 'androidx.activity:activity-compose:1.5.1'
n
I see. Can you share a build scan so I can make sure that these are the versions used in your build?
n
n
Here is how you can create a build scan: https://scans.gradle.com/
n
used the same command. -> /.gradlew build --scan; then copied the contents to this file
n
I see, can you share with me the build scan link at the end of the build?
n
Are you able to access it via email?
n
The build scan you sent me does not seem to encounter the same issue you described in the ticket. It seems like the build failed due to a lint error. Here is more information about the lint error: https://scans.gradle.com/s/5jql5ctpw6hem/console-log?task=:byju-video-player:lintDebug
n
Yes. Also, I am not encountering a build failure. My issue is that the app crashes on launching compose activity, and all the leads online suggest that it is linked to Gradle. https://issuetracker.google.com/issues/176079157
n
I see. Do you expect the
androidx.activity:activity-compose
to be version 1.6.1 on your classpath? Or did you expect it to be 1.5.1?
n
I have tried with both but getting the same crash
E/AndroidRuntime: FATAL EXCEPTION: main Process: co.gradeup.android, PID: 7250 java.lang.NoSuchMethodError: No static method setContent$default(Landroidx/activity/ComponentActivity;Landroidx/compose/runtime/CompositionContext;Lkotlin/jvm/functions/Function0;ILjava/lang/Object;)V in class Landroidx/activity/compose/ComponentActivityKt; or its super classes (declaration of 'androidx.activity.compose.ComponentActivityKt' appears in /data/app/~~6PSpc1Ijar4GTifWOcjgPA==/co.gradeup.android-mnAsRXkH2A-sN_wKenw04Q==/base.apk) at com.gradeup.baseM.view.activity.ComposeActivity.onCreate(ComposeActivity.kt:11) at android.app.Activity.performCreate(Activity.java:8395) at android.app.Activity.performCreate(Activity.java:8374) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1403) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3837) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4006) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:111) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2466) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:240) at android.os.Looper.loop(Looper.java:351) at android.app.ActivityThread.main(ActivityThread.java:8321) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1012)
n
Hmm, does removing
BuildSrc
help here?
n
It is deeply integrated with the app so removing it is not possible. Can I add anything to it that can fix this??
n
The thread suggests that adding the kotlin gradle plugin as a dependency to the
buildSrc
above AGP should work. Have you done that?
n
Yes. didn't work 😕
n
hmm, can you send me a build scan where you did that?
n
Sure, generating the scan
👍 1
c
Yeah, jim sproch helped with this like 2 years ago. ended up being an issue with buildSrc. im confident that its the same issue in this case since you also use buildSrc.
n
@no I didn't realise that I hadn't been able to run the app after adding
Copy code
api "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
to buildsrc. Actually, it is throwing the following error once I add this line: java.lang.RuntimeException: Error generating class file com/gradeup/events/LiveLiterals$GeneratedEventsKt.class (compiled from [/Users/faheemunnisa/Documents/Android2023/BEPAndroid/Hades/BaseModule/base/build/generated/source/events/debug/com/gradeup/events/GeneratedEvents.kt]): Class too large: com/gradeup/events/LiveLiterals$GeneratedEventsKt Any idea whythis is happening on adding this dependency?
@Colton Idle how did you solve it?
@no @Colton Idle I was able to fix the crash by adding api "org.jetbrains.kotlinkotlin gradle plugin$kotlin_version" to buildSrc build.gradle. Thank you guys for your help! But can you tell me how these 2 things are related and how adding this dependency fixed this issue? I am still not able to put twos and twos together
n
I'm just guessing that agp isn't able to find kgp on the class path due to an ordering issue. Adding that fixes the order
c
the explanation for the fix is this comment: https://issuetracker.google.com/issues/176079157#comment14
also. consider not using buildSrc. its been known to be a mess: https://developer.squareup.com/blog/stampeding-elephants/