Status Update
Comments
ya...@google.com <ya...@google.com>
je...@google.com <je...@google.com>
so...@google.com <so...@google.com> #2
As I understand it, we need to migrate namespace definitions both from AndroidManifest.xml
and from implicit definitions from applicationId
/ testApplicationId
? Is that right? So an 8.0 project would have a
namespace <n>
testNamespace <tn>
where <n> is taken from AndroidManifest.xml
package
definitions if present, and applicationId
if not, and <tn>
is testApplicationId
if present and <n>.test
if not?
so...@google.com <so...@google.com> #3
Sorry for the confusion. AGP would change how it computes the namespace for the androidTest variant. All the Upgrade assistant would need to do is update the source code for the import of the R
class.
ga...@google.com <ga...@google.com> #4
OK! And, I think, this should happen at the same time as the namespace
declaration is migrated from AndroidManifest.xml
?
al...@snappautomotive.io <al...@snappautomotive.io> #5
It's unrelated, but it is possible that we move 8.0 to also only declare the namespace into the DSL. I would make it a separate refactoring because they are not tied at all.
ga...@google.com <ga...@google.com> #6
I would consider first adding the right new value to models (as a new property) and then, to avoid Studio interpreting manifests and build configurations, just update to whatever the synced value of this new property is.
al...@snappautomotive.io <al...@snappautomotive.io> #7
Updated version of this in #16 below
Currently, AUA removes the package
attribute from the main manifest and instead specifies that value via the namespace
DSL.
In addition to that, AUA should:
(1) Check for apackage
attribute in the (possibly non-existent) androidTestAndroidManifest.xml
. If there's a value there, it should be removed from that manifest, and if it's not equal tonamespace + ".test"
, it should be specified via thetestNamespace
DSL.Ifnamespace
==testNamespace
, this is problematic because the androidTest and regularR
classes will have the same namespace. Not sure what the best behavior is here? Maybe an error explaining that the user should first reset the androidTest AndroidManifest'spackage
attribute and change the androidTest source code package accordingly?
- (2)
Compare the newtestNamespace
with the oldAndroidProject.androidTestNamespace
from the model. If they are different, search the androidTest source code for references to anR
class namespaced withAndroidProejct.androidTestNamespace
, and change the namespace totestNamespace
.
ga...@google.com <ga...@google.com> #9
I have a draft implementation for the second part of (1) from namespace
and testNamespace
are equal. Is there any documentation we can point to explaining how the user should proceed? (My in-window space budget for explanatory text is pretty limited).
Description
AI-213.7172.25.2113.9123335, JRE 11.0.13+0-b1751.21-8125866x64 JetBrains s.r.o., OS Windows 11(amd64) v10.0 , screens 2880.0x1620.0
AS: Dolphin | 2021.3.1 Patch 1
Kotlin plugin: 213-1.7.20-release-for-android-studio-AS6777.52
Android Gradle Plugin: (plugin information not found)
Gradle: (gradle version information not found)
Gradle JDK: Eclipse Temurin version 11.0.17
NDK: from local.properties: (not specified), latest from SDK: 22.1.7171670
CMake: from local.properties: (not specified), latest from SDK: 3.22.1-g37088a8-dirty, from PATH: (not found)Source: send_feedback_icon
Stack Trace;
java.util.NoSuchElementException: Collection contains no element matching the predicate.
at com.android.tools.idea.gradle.project.sync.idea.SdkSyncUtil.findMatchingSdkForAddon(SdkSyncUtil.kt:175)
at com.android.tools.idea.gradle.project.sync.idea.SdkSyncUtil.computeSdkReloadingAsNeeded(SdkSyncUtil.kt:127)
at com.android.tools.idea.projectsystem.gradle.sync.AndroidModuleDataService.postProcess(AndroidModuleDataService.kt:249)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.lambda$doImportData$1(ProjectDataManagerImpl.java:299)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:134)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:229)
at com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManagerImpl.importData(ProjectDataManagerImpl.java:236)
at com.android.tools.idea.gradle.project.sync.idea.IdeaSyncPopulateProjectTask.populateProject(IdeaSyncPopulateProjectTask.java:57)
at com.android.tools.idea.gradle.project.sync.idea.ProjectSetUpTask.doPopulateProject(ProjectSetUpTask.java:54)
at com.android.tools.idea.gradle.project.sync.idea.ProjectSetUpTask.onSuccess(ProjectSetUpTask.java:48)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.handExecutionResult(ExternalSystemUtil.java:545)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.executeImpl(ExternalSystemUtil.java:525)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.lambda$execute$0(ExternalSystemUtil.java:353)
at com.intellij.openapi.project.DumbServiceHeavyActivities.suspendIndexingAndRun(DumbServiceHeavyActivities.java:21)
at com.intellij.openapi.project.DumbServiceImpl.suspendIndexingAndRun(DumbServiceImpl.java:187)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$2.execute(ExternalSystemUtil.java:353)
at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4.run(ExternalSystemUtil.java:637)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:436)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:120)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:496)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:244)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:829)
2022-09-27 11:33:17,767 [2379038] ERROR - intellij.openapi.progress.Task - Android Studio Dolphin | 2021.3.1 Build #AI-213.7172.25.2113.9014738
2022-09-27 11:33:17,783 [2379054] ERROR - intellij.openapi.progress.Task - JDK: 11.0.13; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2022-09-27 11:33:17,783 [2379054] ERROR - intellij.openapi.progress.Task - OS: Windows 11
2022-09-27 11:33:17,783 [2379054] ERROR - intellij.openapi.progress.Task - Last Action: OpenFile