Status Update
Comments
ph...@gmail.com <ph...@gmail.com> #2
uc...@google.com <uc...@google.com> #3
ga...@gmail.com <ga...@gmail.com> #4
ch...@google.com <ch...@google.com> #5
I couldn't reproduce this problem with 3.6.0 RC1 with the following steps,
1. open a project
2. switch to non-default variant, and wait for import to finish
3. close project or studio
4. reopen project or studio, the variant I selected in step 2 is the current one.
Was your project previously opened with a different version of Studio? Please note that it is expected for variants to be reset when a project is opened by a new version of Studio for the first time. But it should not happen with the subsequent openings.
ga...@gmail.com <ga...@gmail.com> #6
ch...@google.com <ch...@google.com> #7
ga...@gmail.com <ga...@gmail.com> #8
ga...@gmail.com <ga...@gmail.com> #9
so...@google.com <so...@google.com> #10
Could please locate your app module .iml file and confirm that the selected build variant is persisted there before you re-open your project?
It looks like (see SELECTED_BUILD_VARIANT
):
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/main/res;file://$MODULE_DIR$/../../../app/src/debug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/../../../app/src/androidTest/res;file://$MODULE_DIR$/../../../app/src/test/res;file://$MODULE_DIR$/../../../app/src/androidTestDebug/res;file://$MODULE_DIR$/../../../app/src/testDebug/res;file://$MODULE_DIR$/../../../app/build/generated/res/rs/androidTest/debug" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
</facet>
</component>
so...@google.com <so...@google.com> #11
From the video is can be seen that AS does not load the project from cached data and instead launches Gradle to obtain build models.
so...@google.com <so...@google.com> #12
The log file attached does not seem to include log from either before or after re-opening the project.
ga...@gmail.com <ga...@gmail.com> #13
ga...@gmail.com <ga...@gmail.com> #14
so...@google.com <so...@google.com> #15
"pl.ProjectRootManagerComponent - project roots have changed"
is fine and expected.
Could you also share your gradle.xml
from your .idea/
directory? I wonder how many there are <GradleProjectSettings>
elements.
ga...@gmail.com <ga...@gmail.com> #16
so...@google.com <so...@google.com> #17
Thank you. The file is fine.
so...@google.com <so...@google.com> #18
Thank you, I can reproduce the problem. I don't know causes it yet.
so...@google.com <so...@google.com> #19
Do you use:
build.gradle
orbuild.gradle.kts
configuration? (or both)- Is your
buildSrc
project in Java or Kotlin?
Thank you
ga...@gmail.com <ga...@gmail.com> #20
so...@google.com <so...@google.com> #21
Could you
-
list all the
.iml
files you project get after syncing? (They may be located both with your sources or under .idea/modules directory on both places). -
let us know if existing
.iml
files match the files listed in.idea/modules.xml
?
Thank you
ga...@gmail.com <ga...@gmail.com> #22
so...@google.com <so...@google.com> #23
Thank you! Do you happen to have any Kotlin multiplatform or Kotlin/JS modules in your project?
ga...@gmail.com <ga...@gmail.com> #24
ga...@gmail.com <ga...@gmail.com> #25
uc...@google.com <uc...@google.com>
xa...@google.com <xa...@google.com>
so...@google.com <so...@google.com> #26
It looks like AS forgets variant selection if it needs to sync the project after opening. WIf it happens whatever the current variant selection is it is reset to the default one.
It can be easily reproduced by following these steps:
- Create and sync a new Android app
- Switch its only module to
Release
build variant - Make an irrelevant change to its build file (like adding a comment) and DO NOT sync
- Close the project
- Re-open the project
The currently selected variant resets to Debug
so...@google.com <so...@google.com> #27
The problem is exacerbated by an unrelated bug which causes some projects to be synced each time they are opened.
so...@google.com <so...@google.com> #28
Also it means that if a project is re-opened after updating the sources from the VCS it might lose its variant selection as well.
ga...@gmail.com <ga...@gmail.com> #29
so...@google.com <so...@google.com> #30
I96e3840515e6721188d1a986f7f8c4492097d4dc change fixes the problem for non-native variants.
so...@google.com <so...@google.com> #31
Re
so...@google.com <so...@google.com> #32
Possible causes (there are more):
so...@google.com <so...@google.com>
se...@gmail.com <se...@gmail.com> #33
Was the fix cherry-picked to 3.6.2?
ma...@gmail.com <ma...@gmail.com> #34
ce...@gmail.com <ce...@gmail.com> #35
[Deleted User] <[Deleted User]> #36
Since adding
productFlavors {
myFlavor {
isDefault.set(true)
}
}
this has stopped being an issue for me. I use AS 3.6.2.
ma...@trala.com <ma...@trala.com> #37
[Deleted User] <[Deleted User]> #38
It's actually an issue for me again, as well. I wouldn't call it a "big issue", because it happens basically all the time so now I'm very well acquainted with it and how to manually fix it.
[Deleted User] <[Deleted User]> #39
1. set variant to other than default
2. change build.gradle
3. Sync
4. Notice variant is back on default
Multimodule (4 apps and 15 libs) all Kotlin, all build.gradle, no build.gradle.kts, all android, no multiplatform, no defaults set in build.gradle. IML files appear to be correct (i.e. the variant set in step 1 appears in IML)
yu...@dji.com <yu...@dji.com> #40
[Deleted User] <[Deleted User]> #41
Re-appeared in 4.1 for me as well. It's sporadic, but I could reproduce it by executing Gradle Sync a couple of times. I see a correct SELECTED_BUILD_VARIANT
in my app module .iml. The project has some modules with .gradle.kts files.
so...@google.com <so...@google.com> #42
Android Studio 4.1.1 which includes the fix has been relased. If you can still reproduce any of these or similar problems in 4.1.1 please open a new bug.
ta...@gmail.com <ta...@gmail.com> #43
Can confirm, 4.1.1 fixes it for me.
nb...@gmail.com <nb...@gmail.com> #44
Build #AI-201.8743.12.41.6953283, built on November 5, 2020
Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.4.0-58-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 3005M
Cores: 8
Registry: ide.new.welcome.screen.force=true, external.system.auto.import.disabled=true
Non-Bundled Plugins: name.kropp.intellij.makefile
Current Desktop: ubuntu:GNOME
Hi all, i have a problem with my project. After change some build config (buid.gradle - app module) and resync (File -> Sync project with gradle files), file BuildConfig.java is disappeared, the ide can not detect generated java folder (picture 1). Current build variant is "Debug", i have to change to other build variant (ex: Release) and rechage it back to "Debug" to make ide detect BuildConfig.java file. I think it is the same issue. And i detect some missing in java.app.iml file (picture 2).
so...@google.com <so...@google.com> #45
Re Help | Show Logs..
)
Description
Build #AI-192.6603.28.36.5916306, built on October 3, 2019
Runtime version: 1.8.0_212-release-1586-b4-5784211 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 4012M
Cores: 12
Registry: ide.new.welcome.screen.force=true
Non-Bundled Plugins: org.jetbrains.kotlin, com.squareup.sqldelight
I usually have a variant called "stagingApiDebug" selected, but after every restart it just selects the alphabetically first one, in my case "productionApiDebug". The bug did not exist in 3.5.1.