Status Update
Comments
ra...@google.com <ra...@google.com> #2
ra...@google.com <ra...@google.com>
ap...@google.com <ap...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
ma...@marcardar.com <ma...@marcardar.com> #4
I also needed this feature and 1.1.0-alpha1
seems to be working well. All I did was create a new provider class (FooProcessInitializationProvider
) extending InitializationProvider
(otherwise empty) and adding this to the manifest:
<provider
android:name=".FooProcessInitializationProvider"
android:authorities="${applicationId}:fooprocess.androidx-startup"
android:exported="false"
android:process=":fooprocess">
<meta-data
android:name="myapp.FooProcessInitializer"
android:value="androidx.startup" />
</provider>
I think these are the minimal steps required, right (i.e. that name and authorities need to be unique)?
As a side note, it would be nice if android:name
(in meta-data) would support local class names (e.g. android:name=".FooProcessInitializer"
)
ra...@google.com <ra...@google.com> #5
That is correct.
As a side note, it would be nice if android:name (in meta-data) would support local class names (e.g. android:name=".FooProcessInitializer")
We tried making that part work originally. However determining the package name
is expensive during startup.
lo...@gmail.com <lo...@gmail.com> #6
It could be done at compile time, with a trick similar to the ${applicationId}
manifest placeholder, or right into the manifest merger, or via a generated manifest (e.g. generated via Kotlin code, possibly using DSL(s)).
ma...@marcardar.com <ma...@marcardar.com> #7
I don't think AppInitializer.discoverAndInitialize()
is reading the metadata of a custom InitializationProvider
, so the initializer needs to be declared separately.
ra...@google.com <ra...@google.com> #8
Yes, the InitializationProvider
needs to be declared per-process.
ma...@marcardar.com <ma...@marcardar.com> #9
Are you sure the metadata tag declared on the custom InitializationProvider
is being parsed? Looking at AppInitializer.discoverAndInitialize()
it looks like it's only looking at non-custom InitializationProvider
ra...@google.com <ra...@google.com> #10
Every provider declaration will also have to declare the <meta-data>
entries it cares about. Unfortunately, we cannot make the assumption that Initializer
s that are important for one process are important for every process.
ma...@marcardar.com <ma...@marcardar.com> #11
I'm seeing the opposite behaviour. Using the code shown in
ra...@google.com <ra...@google.com> #12
Are you sub-classing InitializationProvider
and defining a new entry in your AndroidManifest.xml
?
Can you also please send a sample app and logs so I can better understand what is going on.
ma...@marcardar.com <ma...@marcardar.com> #13
Maybe you should be passing the Initialization
Class
to AppInitializer.discoverAndInitialize()
as an argument, so that it can query the PackageManager
using that instead of InitializationProvider.class
ma...@marcardar.com <ma...@marcardar.com> #14
The code is literally
class FooProcessInitializationProvider : InitializationProvider()
ra...@google.com <ra...@google.com> #15
Please send us a full sample app. That and logs will tell me whats going on.
ma...@marcardar.com <ma...@marcardar.com> #16
I don't have the time right now, unfortunately. I'd urge you to look carefully at InitializationProvider
.
ma...@marcardar.com <ma...@marcardar.com> #17
I'm also getting Lint errors on release builds:
Error: Every Initializer needs to be accompanied by a corresponding <meta-data> entry in the AndroidManifest.xml file. [EnsureInitializerMetadata from startup-runtime-1.1.0]
and
Error: Missing Initializer no-arg constructor [EnsureInitializerNoArgConstr from startup-runtime-1.1.0]
However, it is giving these messages for abstract initializers, which is surely incorrect.
ub...@gmail.com <ub...@gmail.com> #18
Seeing the same behavior as the other commenter, with the same setup: meta-data tags being ignored for second process provider declaration, meta-data from default process provider declaration is being used instead for second process provider. Makes the multiprocess support fairly useless. Is there a desire to actually make it work?
ch...@gmail.com <ch...@gmail.com> #20
Why not use the
This attribute is not implement?
ga...@gmail.com <ga...@gmail.com> #23
Mac duflicate un prods verfier aosp iD in prod
eu...@gmail.com <eu...@gmail.com> #24
ha...@gmail.com <ha...@gmail.com> #25
Thanks!
ra...@google.com <ra...@google.com> #26
The release is scheduled for Jan 11, 2023. Apologies for the delay !
Description