https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
m

magnumrocha

01/28/2021, 6:37 PM
does anyone having problem after update Android Studio Arctic Fox Canary 5 (2020.3.1.5) ?
Copy code
FAILURE: Build failed with an exception.

* What went wrong:
lateinit property variantName has not been initialized
j

John O'Reilly

01/28/2021, 6:38 PM
Just clutching at straws here but did you also update gradle wrapper as well (should happen as part of update it prompts you for if you accept that)?
Though I get a different error here if that isn't updated
m

magnumrocha

01/28/2021, 6:40 PM
Android Studio Arctic Fox Canary 5 (2020.3.1.5) Android Gradle Plugin 7.0.0-alpha05 Gradle 6.8.1
j

John O'Reilly

01/28/2021, 6:41 PM
I'm on 6.8 for some reason but probably shouldn't make too much difference
m

magnumrocha

01/28/2021, 6:42 PM
but, is it now working for you? after you update the gradle wrapper…
j

John O'Reilly

01/28/2021, 6:42 PM
yeah, everything seems to be fine
updated likes of https://github.com/joreilly/BikeShare for example
(along with the other KMP repos I have)
m

magnumrocha

01/28/2021, 7:49 PM
I’ve just created a fresh new project and the error still occurring:
Copy code
19:43:55: Executing task 'build'...

Executing tasks: [build] in project /Users/[my_user]/MyApplication/app


FAILURE: Build failed with an exception.

* What went wrong:
lateinit property variantName has not been initialized
Android Studio Arctic Fox Canary 5 (2020.3.1.5) Android Gradle Plugin 7.0.0-alpha05 Gradle 6.8
1
s

Sean Keane

01/29/2021, 12:00 AM
Change your gradle plugin to 4.1.0
👎 1
🤷‍♂️ 1
d

darkmoon_uk

01/29/2021, 5:55 AM
@magnumrocha I have the same problem. @Sean Keane 4.1.0 won't support the latest Compose Alpha.
👍 1
@magnumrocha Running with
--stacktrace
shows that the error is coming from Android Lint. I tried to disable Lint, but it's still being queried, apparently during Gradle's setup of its build logging/analytics.
s

Sean Keane

01/29/2021, 12:17 PM
@darkmoon_uk I had a similar issue. This was the resolution. https://youtrack.jetbrains.com/issue/IDEA-252823 No mention of Compose in this thread though so it's worth a try.
m

magnumrocha

01/29/2021, 12:23 PM
the problem is Android Studio Arctic Fox Canary 5 (2020.3.1.5) only works with AGP 7.0.0-alpha05, we can’t downgrade AGP version
s

Sean Keane

01/29/2021, 12:26 PM
Have you a sample project I can check with?
Copy code
//ROOT GRADLE
ext.android_gradle = '7.0.0-alpha05'
//GRADLE WRAPPER PROPERTIES 
distributionUrl=<https://services.gradle.org/distributions/gradle-6.8-bin.zip>
This works for me. Just updated a test project. Zero issues.
m

magnumrocha

01/29/2021, 12:37 PM
a fresh new Android Project, created on Android Studio Arctic Fox Canary 5 (2020.3.1.5) :
s

Sean Keane

01/29/2021, 12:37 PM
2 sec and I'll check on my end.
m

magnumrocha

01/29/2021, 12:37 PM
the `gradle-wrapper.properties`:
Copy code
#Thu Jan 28 19:43:08 WET 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
s

Sean Keane

01/29/2021, 12:38 PM
No issues for me Executing tasks: [appassembleDebug] in project /Users/sean/AndroidStudioProjects/TestGradlePlugin
Task apppreBuild UP-TO-DATE
Task apppreDebugBuild UP-TO-DATE
Task appcompileDebugAidl NO-SOURCE
Task appcompileDebugRenderscript NO-SOURCE
Task appgenerateDebugBuildConfig
Task appgenerateDebugResValues
Task appgenerateDebugResources
Task appcheckDebugAarMetadata
Task appcreateDebugCompatibleScreenManifests
Task appextractDeepLinksDebug
Task appprocessDebugMainManifest
Task appprocessDebugManifest
Task appmergeDebugNativeDebugMetadata NO-SOURCE
Task appjavaPreCompileDebug
Task appmergeDebugShaders
Task appcompileDebugShaders NO-SOURCE
Task appgenerateDebugAssets UP-TO-DATE
Task appmergeDebugAssets
Task appcompressDebugAssets
Task appprocessDebugJavaRes NO-SOURCE
Task appmergeDebugResources
Task appcheckDebugDuplicateClasses
Task appdesugarDebugFileDependencies
Task appmergeDebugJniLibFolders
Task appmergeLibDexDebug
Task appmergeDebugNativeLibs NO-SOURCE
Task appstripDebugDebugSymbols NO-SOURCE
Task appvalidateSigningDebug
Task appwriteDebugAppMetadata
Task appwriteDebugSigningConfigVersions
Task appprocessDebugManifestForPackage
Task appprocessDebugResources
Task appmergeExtDexDebug
Task appcompileDebugKotlin
Task appcompileDebugJavaWithJavac
Task appcompileDebugSources
Task appdexBuilderDebug
Task appmergeProjectDexDebug
Task appmergeDebugJavaResource
Task apppackageDebug
Task appassembleDebug
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings BUILD SUCCESSFUL in 13s 28 actionable tasks: 28 executed Build Analyzer results available
@magnumrocha What did you select when creating the project? Blank activity or Compose Preview?
m

magnumrocha

01/29/2021, 12:40 PM
Blank Activity
s

Sean Keane

01/29/2021, 12:43 PM
Same on my end. It just built. Did you reset your cache.
m

magnumrocha

01/29/2021, 12:43 PM
yes, I did, but I will do again, 1 sec.
same problem.
s

Sean Keane

01/29/2021, 12:45 PM
Can you check all SDK build tools are also updated?
👌 1
m

magnumrocha

01/29/2021, 12:45 PM
is that your setup?
d

darkmoon_uk

01/29/2021, 12:46 PM
I previously deleted entire
.gradle
folder and got the same (bugged) result so keen to hear how this goes...
s

Sean Keane

01/29/2021, 12:47 PM
Android Studio Arctic Fox | 2020.3.1 Canary 5 Build #AI-203.6682.168.2031.7101492, built on January 25, 2021 Runtime version: 11.0.8+10-b944.6842174 x86_64 VM: OpenJDK 64-Bit Server VM by N/A macOS 10.15.7 GC: G1 Young Generation, G1 Old Generation Memory: 4096M Cores: 24 Registry: external.system.auto.import.disabled=true Non-Bundled Plugins: com.mallowigi, com.vincentp.gruvbox-theme
Did you update, or clean install? (I updated)
m

magnumrocha

01/29/2021, 12:48 PM
I made the Update
s

Sean Keane

01/29/2021, 12:49 PM
Can you give me the build.gradle file?
Copy code
12:49:50: Executing task 'compileLintChecks'...

Executing tasks: [compileLintChecks] in project /Users/sean/StudioProjects/guineaGram/app


> Configure project :app
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (<https://goo.gle/kotlin-android-extensions-deprecation>) to start working with View Binding (<https://developer.android.com/topic/libraries/view-binding>) and the 'kotlin-parcelize' plugin.
WARNING: API 'BaseVariant.getApplicationIdTextResource' is obsolete and has been replaced with 'VariantProperties.applicationId'.
It will be removed in version 7.0 of the Android Gradle plugin.
For more information, see TBD.
To determine what is calling BaseVariant.getApplicationIdTextResource, use -Pandroid.debug.obsoleteApi=true on the command line to display more information.

> Task :app:compileLintChecks UP-TO-DATE

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See <https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings>

BUILD SUCCESSFUL in 150ms
12:49:51: Task execution finished 'compileLintChecks'.
Ok! It's the Linter. Its not running for my build on a blank project but when I run it separately I get this
Copy code
lateinit property variantName has not been initialized

* 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.
🙃 2
Lol! Now I'm in you're situ on all the gradle tasks
d

darkmoon_uk

01/29/2021, 12:52 PM
Yes
I saw from the stack trace that it has something to do with the linter
But trying to disable linting doesn't help
Further down the stack trace suggests it's not really the act of linting either
s

Sean Keane

01/29/2021, 12:54 PM
Here's how I fixed it. Go to "Build Variant" -> Change to release -> Build -> Change back to debug -> Build.
d

darkmoon_uk

01/29/2021, 12:55 PM
I get the linter error when building from command line though, so my question would be how is that UI operation affecting the underlying Gradle invocation
s

Sean Keane

01/29/2021, 12:55 PM
That only works for building the app and not running it on a device
Ok. Resolved on my side. • Close the project • Go to the folder where the file is saved • Delete .gradle • Delete .idea • Empty bin (Just incase) • Re-open project • Press Play.
👎 1
🤔 1
d

darkmoon_uk

01/29/2021, 1:04 PM
Umm... In summary does that mean that just clearing caches thoroughly fixed it?
s

Sean Keane

01/29/2021, 1:06 PM
Clearing the cache's for AS doesn't. Manually clearing the caches does. When you run the clean command it doesn't "Clean" everything. So a manual delete forces the .gradle and .idea to be re-created to the standard of the project. So I'm guessing its an issue with the template as my other existing projects didn't have this problem.
m

magnumrocha

01/29/2021, 1:08 PM
not working for me….
d

darkmoon_uk

01/29/2021, 1:08 PM
Back on laptop, about to give it a go... but in my previous attempts to fix this I had 'deep cleaned'
Deleting
.gradle
.idea
should be irrelevant to a command line build
and those are failing for me; I'm not building from the IDE.
m

magnumrocha

01/29/2021, 1:09 PM
I discover the problem in a project that I was working before the AS update, then I’ve create a new project just to check if it was config Issue on my previous project
running by the gradle command line , with the AS closed I get the same problem….
s

Sean Keane

01/29/2021, 1:10 PM
I just seen that my workspace.xml between my "new project" and the one I fixed is different.
d

darkmoon_uk

01/29/2021, 1:11 PM
The problem when seen here is not to do with the IDE as @magnumrocha says
It happens in command-line Gradle build.
m

magnumrocha

01/29/2021, 1:11 PM
sure, the Issue is on AGP 7.0.0-alpha05
s

Sean Keane

01/29/2021, 1:13 PM
I managed to get my second app that wasn't working - working.
d

darkmoon_uk

01/29/2021, 1:15 PM
Sean do you mean by when you selected the variant manually in the IDE?
s

Sean Keane

01/29/2021, 1:15 PM
Bottom left corner, where you have "Build Variant" change it
d

darkmoon_uk

01/29/2021, 1:15 PM
If so, it sounds like that caused the IDE to invoke Gradle with some flag to specify the variant.
I'm not building in the IDE.
s

Sean Keane

01/29/2021, 1:16 PM
Yep! And it seems by not declaring it in the CLI its having a hissy fit.
d

darkmoon_uk

01/29/2021, 1:17 PM
Hmm, so what's the flag to specify variant to the CLI 🤔
That would make for a workaround
s

Sean Keane

01/29/2021, 1:18 PM
assembleDebug
d

darkmoon_uk

01/29/2021, 1:19 PM
Yep understand it ordinarily takes this from component of the task name
I was trying to run
check
Ok, so maybe I can limit to the Gradle tasks that specify variant... to limp through.
s

Sean Keane

01/29/2021, 1:20 PM
It seems if the Variant name is specified with the assemble task it works. I can install and run the project. So I'm guessing the issue here is the build doesn't have its default for debug in the CLI tool.
d

darkmoon_uk

01/29/2021, 1:20 PM
But this is definitely looking like a serious bug in
alpha05
👌 1
s

Sean Keane

01/29/2021, 1:20 PM
If you want more variants you can just declare them in the .gradle file and re-import.
d

darkmoon_uk

01/29/2021, 1:22 PM
I'm kind of surprised something this major could get through the Gradle Plugin CI pipeline TBH, you'd think there would be a unit test for performing a variantless build on... anything.
s

Sean Keane

01/29/2021, 1:22 PM
Don't be fooled. Unit tests are only as good as the people who write them 😉
🙂 1
Hopefully this will see you guys through!
K 1
d

darkmoon_uk

01/29/2021, 1:31 PM
Thanks @Sean Keane! We're definitely in bat country with '`alpha11` and friends' - plenty of other bugs being reported as well.
...but I didn't pick this tech stack for an easy ride 😉
K 1
🎉 1
💪 1
💯 1
👍 3
m

magnumrocha

01/29/2021, 1:56 PM
thank you guys @darkmoon_uk @Sean Keane 👍
👍 2
i

Ian Arbuckle

01/31/2021, 2:37 PM
I can confirm I'm getting the same issues with my KMM project. Fingers cross this gets resolved quickly 🤞
🤞 3
u

Umit AYDIN

02/03/2021, 12:03 AM
This has been fixed in AGP 7.0.0-alpha07 😃
🎉 4
d

darkmoon_uk

02/03/2021, 9:14 AM
@Umit AYDIN As of now, 'only' two releases away 😨 https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google It got recognised as a P1 in the Google Issue so they might bring it forward? Good thing we can work around it.
💯 3
m

magnumrocha

02/03/2021, 9:50 AM
I hope they release the
7.0.0-alpha06
and
7.0.0-alpha07
together….
3 Views