Status Update
Comments
au...@google.com <au...@google.com>
au...@google.com <au...@google.com> #2
imorlowska@ can you comment if this is a KI?
je...@google.com <je...@google.com> #3
im...@google.com <im...@google.com> #4
Scott, could you please take a look? I'm OOO for the next 2 weeks but can have a look too once I'm back.
sp...@google.com <sp...@google.com> #5
I agree that the warning message needs improvement, but would it be possible to use package="androidx.ads.identifier"
in your AndroidTest manifest, instead of package="androidx.ads.identifier.test"
?
The package will be set to "androidx.ads.identifier.test"
in the AndroidTest APK either way, but you won't get a warning with the former.
au...@google.com <au...@google.com> #6
That seems confusing. Don't we want the package to be androidx.ads.identifier.test
for tests?
Are you simply proposing a workaround until AGP fixes this issue?
sp...@google.com <sp...@google.com> #7
AGP automatically appends .test
to the package in the AndroidTest APK's AndroidManifest.xml
.
Is there a reason you also need it to be androidx.ads.identifier.test
in the source AndroidManifest.xml
?
Correction: AGP uses the tested app's applicationId + ".test"
for the AndroidTest APK's package name. See
au...@google.com <au...@google.com> #8
Ideally, looking at the AndroidManifest.xml
you see the final test package, which includes .test
. It seems a bit odd to have androidx.ads.identifier
which is the package of the main library, which then silently gets replaced with androidx.ads.identifier.test
.
sp...@google.com <sp...@google.com> #9
Okay, I think the correct workaround is to set android.defaultConfig.testApplicationId "androidx.ads.identifier.test"
and remove the package
attribute entirely from the AndroidTest AndroidManifest.xml
.
Currently, the package
attribute of the AndroidTest AndroidManifest.xml
has no impact on the package in the merged manifest.
I'm not sure what the desired behavior is here. +android-gradle@
au...@google.com <au...@google.com> #10
We'd like to have consistency, so that library package is androidx.foo
, and test has androidx.foo.test
. Is there a programmatic way to do that? I'd prefer we don't hardcode all of these values in build.gradle
sp...@google.com <sp...@google.com> #11
Yes, if you remove the package
attribute from the AndroidTest AndroidManifest.xml
, then the package names will use that exact convention.
sp...@google.com <sp...@google.com> #12
I discussed this with jedo@ and xav@ to see what the desired behavior is.
Long-term, specifying a package in the AndroidManifest.xml
should be an error, and there should instead be a way to specify it via the DSL (both for the app/library and for the androidTest).
AFAICT, the package
attribute of the AndroidTest AndroidManifest.xml
hasn't impacted the build for quite a while, so I don't think we'll add that functionality now.
We need to do the following:
(1) Add package
and testPackage
to AGP's DSL.
(2) Move users' package values from AndroidManifest.xml
to the DSL via the upgrade wizard.
(3) Eventually warn users if they set package
in the AndroidManifest.xml
. And eventually make this an error.
sj...@google.com <sj...@google.com> #13
Removing the package attribute from the androidTest AndroidManifext.xml causes build failure for me with the changes in
The stacktrace is:
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':heifwriter:heifwriter:processDebugAndroidTestManifest'.
at org.gradle...
Caused by: java.lang.RuntimeException: Manifest merger failed : Main AndroidManifest.xml at AndroidManifest.xml manifest:package attribute is not declared
at com.android.build.gradle.tasks.ProcessTestManifest.handleMergingResult(ProcessTestManifest.kt:315)
at com.android.build.gradle.tasks.ProcessTestManifest.mergeManifestsForTestVariant(ProcessTestManifest.kt:266)
at com.android.build.gradle.tasks.ProcessTestManifest.doFullTaskAction(ProcessTestManifest.kt:106)
at com.android.build.gradle.internal.tasks.IncrementalTask.handleIncrementalInputs(IncrementalTask.kt:110)
at com.android.build.gradle.internal.tasks.IncrementalTask.access$handleIncrementalInputs(IncrementalTask.kt:65)
at com.android.build.gradle.internal.tasks.IncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(BaseTask.kt:73)
at com.android.build.gradle.internal.tasks.IncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(BaseTask.kt:36)
at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:91)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction$gradle(IncrementalTask.kt:137)
at jdk.internal.reflect.GeneratedMethodAccessor862.invoke(Unknown Source)
at java.base...
This is with gradle 6.7 and AGP version 4.2.0-alpha06
je...@google.com <je...@google.com> #14
yes this will be a change of behavior, first we need to add DSL elements so you can set it there and then we will stop failing loading manifest files that do not have a package declaration.
sp...@google.com <sp...@google.com> #15
Ah, I hit the same error with AGP 4.2.0-alpha06, but I don't hit it with 4.2.0-alpha13.
It looks like the reason is because
sp...@google.com <sp...@google.com> #16
I filed
au...@google.com <au...@google.com> #17
Verified that with 4.2.0-alpha15 we are able to remove the manifest package, however, I do think this should be a clearer warning or it should have no warning.
sp...@google.com <sp...@google.com> #18
+1
sp...@google.com <sp...@google.com>
ji...@google.com <ji...@google.com>
au...@google.com <au...@google.com> #19
When should the fix ship? Will it be in the next 7.0.0-* release? can we make sure to cherrypick it?
Description
I'm observing when building AndroidX that running
processDebugAndroidTestManifest
is generating some warnings. For example:generates this output:
After some investigation, it seems that the minimal amount of code required to reproduce this problem is:
./src/androidTest/AndroidManifest.xml:
./src/main/AndroidManifest.xml:
./build.gradle:
It seems to me that there are a few confusing aspects of this output:
The fact that it is unexpected to find the same package in multiple manifests could be made more clear by adding the word "multiple", perhaps: "Package $package used in multiple manifests: $manifest1, $manifest2"
The warning says "AndroidManifest.xml, manifestMerger17468703757590145208.xml." but it's difficult to identify where
manifestMerger17468703757590145208.xml
comes from.It seems to me that although the reported conflict is
androidx.ads.identifier.test
, that it would be easier to interpret if the conflict were instead reported asandroidx.ads.identifier
. That would make it easy for a user to rungrep -r "androidx.ads.identifier"
and immediately see both conflicting instances.Could the warning be made to explain why it is undesirable to have these partially overlapping package names? I'm unsure whether I should file a bug on corresponding library owners, asking them to change the package names.
Thanks!
Gradle version: 6.5.1
Android Plugin Version: 4.2.0-alpha06
Module Compile Sdk Version: android-30
Module Build Tools Version: 29.0.3