Hello I'm encountering a problem uploading AABs v...
# gradle
k
Hello I'm encountering a problem uploading AABs via firebase app distribution. The problem appeared after moving a custom task out of app-level gradle file and into buildSrc class
Copy code
Unable to load class 'com.android.build.gradle.internal.api.InstallableVariantImpl'.

This is an unexpected error. Please file a bug containing the idea.log file.
This error only occurs when trying to upload variants that declare
artifactType = "AAB"
. The only dependency change is adding
implementation("com.google.firebase:firebase-appdistribution-gradle:2.1.3")
to buildSrc/build.gradle.kts. app/build.gradle.kts still configures productFlavors distribution properties as it did before when it was working without a problem.
v
Is that an error you get from Gradle? Because the reference to
idea.log
in your message makes me think you have an IDE issue.
k
@Vampire I receive a ClassNotFound exception
If i keep all the firebase-app-distro stuff in app-level, no problem.
v
That neither answers my question, nor invalidates my suspicion. 😉
k
@Vampire Sorry, I don't have any more information beyond what is provided to me in the error. The gradle task fails, it says the reason for this failure is what I posted in the first message
Copy code
ClassNotFoundException: com.android.build.gradle.internal.api.InstallableVariantImpl
The gradle task which is failing is "appDistributionUploadMyBuildVariant", which happens to be a variant on which the app distribution's properties
artifactType = "AAB"
v
If you are using IntelliJ or Android Studio you might easily miss that there is more information due to this annoyance: https://youtrack.jetbrains.com/issue/IDEA-226613/Gradle-build-on-failed-build-IDE-auto-focuses-and-shows-incomplete-error-message-which-makes-it-hard-to-understand-why-build 2 so you need to select a higher node in the tree to see the actual error details.
k
@Vampire Thanks but the reason I said
ClassNotFoundException
is because that was the error output when looking higher in the tree
This is it
Copy code
> Task :android:app:appDistributionUploadMyVariant-prodRelease FAILED

Execution failed for task ':android:app:appDistributionUploadMyVariant-prodRelease'.
> java.lang.ClassNotFoundException: com.android.build.gradle.internal.api.InstallableVariantImpl

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
v
And if you follow the advice?
So, with
--stacktrace
or optimally you could provide a build scan
k
too many lines with stacktrace to post here
v
Attach it as file
Or use some paste service
pastebin.com for example
k
Ok one sec but I'm not finding any helpful information in these options. They all point back to ClassNotFound. There is some issue when trying to having that dependency in both app build and buildSrc build.
v
That you don't see helpful information does not mean others do not see helpful information, especially if they asked for it. 😉
Try also adding the AGP where you added the Firebase plugin
As it is Firebase that tries to access an AGP class and cannot find it
Probably a problem with class loader hierarchy
k
While this works for just running the gradle task, Adding AGP to buildSrc module introduces more complications, specifically running into
Copy code
org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering

The root cause java.lang.RuntimeException was thrown at: org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)
This is some issue with inlining Jetpack Compose code in one of the app modules and requires the Kotlin gradle plugin to then also be added to buildSrc. This introduces more complications.. I'm moving the DistributionTask back to app-level for now as there doesn't seem to be a straightforward way to achieve what I was going for. I guess some point inside
UploadDistributionTask.getAabPath(AppDistributionProperties param1)
,(I can't decompile implementation) there is a call to AGP class whereas
UploadDistributionTask.getApkPath(AppDistributionProperties param1)
must not call that AGP class. But that seems strange as the class name in question does not strike me as something unique to AAB vs APK. blob shrug Thanks for your input