Status Update
Comments
uc...@google.com <uc...@google.com> #2
For the KSerializer
to Saver
direction,
val <T : Any> KSerializer<T>.saver: Saver<T, SavedState> get() = Saver(
save = { encodeToSavedState(this@saver, it) },
restore = { decodeFromSavedState(this, it) },
)
is working well.
It would be great if this was provided somewhere in a library.
je...@google.com <je...@google.com>
ga...@google.com <ga...@google.com> #3
We're focusing our support on KSerializer.toSaver()
. We won't be implementing Saver.toSerializer()
because KSerializer
works with any Encoder
/Decoder
and trying to use a Saver
to encode any other format besides SavedState
/Bundle
would be an error.
ga...@google.com <ga...@google.com> #4
We plan to introduce KSerializer.toSaver()
in androidx.compose.runtime.saveable
as an optional feature. We will include an dependency on KTX Serialization (if not used by clients, R8 will remove it) but will not depend on savedstate
, as the implementation here does not rely on any savedstate
-specific symbols.
ha...@googlemail.com <ha...@googlemail.com> #5
Project: platform/frameworks/support
Branch: androidx-main
Author: Marcello Galhardo <
Link:
Expose SavedStateConfig
properties as public
Expand for full commit details
Expose `SavedStateConfig` properties as public
- We have cases where `SavedStateConfig` properties need to be used in other modules, such as handling fallbacks with `serializersModule.serializer()` to support contextual and polymorphic serializers.
- To follow KTX Serialization convention, we are keeping `SavedStateConfig` properties public, similar to how `JsonConfiguration` does.
RelNote: "`SavedStateConfig` properties are now public, enabling other modules to use these configurations."
Bug: 378897438
Test: N/A
Change-Id: Ie5f4997bc61932de390da3699339e01b2e91b514
Files:
- M
savedstate/savedstate/api/current.txt
- M
savedstate/savedstate/api/restricted_current.txt
- M
savedstate/savedstate/bcv/native/current.txt
- M
savedstate/savedstate/src/commonMain/kotlin/androidx/savedstate/serialization/SavedStateConfig.kt
Hash: ec92c9e6c519cd5c3b3ea54ea523e4b7dc2a15dc
Date: Tue Feb 18 14:27:58 2025
ha...@googlemail.com <ha...@googlemail.com> #6
We’ve decided not to provide a public helper function for converting from Saver
to KSerializer
, as we’re planning to implement a rememberSaveable
function that accepts a KSerializer
(see rememberSaveable
variant.
(Please note that we introduced an internal helper function in rememberSaveable
variant.)
ha...@googlemail.com <ha...@googlemail.com> #7
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.runtime:runtime-saveable:1.9.0-alpha01
androidx.compose.runtime:runtime-saveable-android:1.9.0-alpha01
androidx.compose.runtime:runtime-saveable-jvmstubs:1.9.0-alpha01
androidx.compose.runtime:runtime-saveable-linuxx64stubs:1.9.0-alpha01
androidx.compose.ui:ui-tooling:1.9.0-alpha01
androidx.compose.ui:ui-tooling-android:1.9.0-alpha01
androidx.compose.ui:ui-tooling-jvmstubs:1.9.0-alpha01
je...@google.com <je...@google.com>
ga...@google.com <ga...@google.com> #8
Please note that if you are using plugin's internal or Retrolamba support for Java 8 language features, for each lambda expression you will generate 3 additional references, so it might affect your reference count quite significantly.
ma...@gmail.com <ma...@gmail.com> #9
Could you please clarify?
Thank you for your time
ga...@google.com <ga...@google.com> #10
I suggest you take a look at Proguard rules that you can specify when running the tests -
ma...@gmail.com <ma...@gmail.com> #11
Thank you for the link and clarification.
Pardon my many questions I just want to understand the problem better.
We use proguard for the app and define proguard rules which classes to keep for the test runner that we need early on in the start of the test run.
Why did it work with older build tools?
Also why doesnt multidex work for the test app or proguard rules from the debug builds?
Thank you for the quick response
ga...@google.com <ga...@google.com> #12
The fact that it worked with 2.3.0 and not with 2.4.0-alpha4 is worrying. Because I am unable to reproduce with the test project you've provided, can you please compare the contents of build/intermediates/transforms/preDex/androidTest/ when building tests:
- from clean, with 2.3.0
- from clean, with 2.4.0-alpha4, with -Pandroid.useDexArchive=false
The content of these 2 directories should be the same. Please report any differences.
The support in the test runner is missing to be able to run test apk with multiple DEX files. I don't have much more info on it, sorry.
ma...@gmail.com <ma...@gmail.com> #13
sorry I am a bit restricted in the work environment so I cannot build the demo project from this location but I executed a diff on a real project where the issue happens for dex folders (predex is not available in 2.3.0) its disabled for our project.
this is for 2.3.0 and 2.4.0-alpha4 in location build/intermediates/transforms/dex/androidTest/nonPayMexicoBleeding for following command:
./gradlew clean connectedNonpayMexicoBleedingDebugAndroidTest
I used flag -Pandroid.useDexArchive=false for 2.4.0 only.
diff -rq nonpayMexicoBleeding\ 2.3.0/ nonpayMexicoBleeding\ 2.4.0-alpha4/
Result:
Only in nonpayMexicoBleeding 2.3.0/debug/folders/1000: 1
Only in nonpayMexicoBleeding 2.3.0/debug/folders/1000: 10
Only in nonpayMexicoBleeding 2.4.0-alpha4/debug/folders/1000: 1f
Does this help?
ma...@gmail.com <ma...@gmail.com> #14
./gradlew clean connectedNonpayMexicoBleedingDebugAndroidTest
Gradle 3.4.0-alpha7 breaks
Commit: ca9e7f7134e5418f9e27e3164efe25521a324a46
Gradle 3.1.2 works
Commit: cfa48cf0b25427d48b328ef6cf80d51fc4e5933b
Cheers
ga...@google.com <ga...@google.com> #15
ga...@google.com <ga...@google.com> #16
je...@google.com <je...@google.com> #17
ga...@google.com <ga...@google.com> #18
- If the tested app is mono-dex, test will be mono dex for < 21, and multidex for 21+.
- If the tested app is native multidex, test is as well.
- And if the tested app is legacy multidex, test is mono dex (because currently the test runner does not support pre 21 test multidex apks).
WDYT?
ma...@gmail.com <ma...@gmail.com> #19
Sounds like a solution that would make it work on gradle 3.4.0>= ?
What are the side effects from the architecture point of view, performance etc, depending on the effort there would it pay off to bring full multidex support to test runner and test apk both?
I always find it confusing what is the difference between:
-multidex test apk
-multidex test runner
I thought that multidex apk is already supported by MultidexInstrumentationTestRunner
so that should work, or are you suggesting to introduce the multidex support to the test runner also (what is less effort and more benefit from your side? )
Best regards & thanks for your time
ga...@google.com <ga...@google.com> #20
For api levels 21+, ART supports multidex for both the test apk and tested apk, so nothing needs to be done there, and there is no performance penalty. However, multidex for < 21 requires patching the class loader, which is done by the test runner for the tested APK. The test runner is unable to patch the class loader for the test apk though, and we this change is not going to change that. So if you are testing your application with min sdk below 21, you will still have to make sure that the test apk contains a single DEX file.
ma...@gmail.com <ma...@gmail.com> #21
thank you for the explanation. But I still dont understand why did it work before for api <21, what broke it?
Will that be fixed?
Thank you for your time.
ga...@google.com <ga...@google.com> #22
ma...@gmail.com <ma...@gmail.com> #23
If this is a decision from the Android team, could you at least give us instructions how to do this patching on our own. I am amazed that we did not see so much breaking problems up until now, but you are telling us that technically we had a bug/s that is now exposed with the change you guys did now.
Is there a way to add this manual patching by ourselves then, and how to do it?
Thx for the support.
ga...@google.com <ga...@google.com> #24
ma...@gmail.com <ma...@gmail.com> #25
Is there a way to connect this bug to that commit and somehow get an ETA, we rely heavily on our instrumentation for a safety net and this is a show stopper for us so I need to relay and prioritize this information accordingly in the company.
To be honest the biggest worry for me here is that some of the classes you have there are package protected e.g. MultidexExtractor (from the first glance) so I would have to find a way to find proper list of dex files created from test apk, instrumentation and the app and sum them together in the test runner, not sure can I duplicate this behaviour but I will take a look in it in more detail starting next work week.
ga...@google.com <ga...@google.com>
ma...@gmail.com <ma...@gmail.com> #26
Could we link this bug to the commits and merge them in 2.4.0?
Thanks
ga...@google.com <ga...@google.com> #27
@Mario The change is part of the multidex support library, and that is released as part of the SDK (not plugin nor Android Studio). Once the change is in, I will work on adding the support in the plugin. Unfortunately, I cannot provide any ETA. The owner of that change is aware of this bug (it is referenced from an internal bug report that is assigned to him).
jw...@gmail.com <jw...@gmail.com> #28
1. using native multidex, the fix will be available in the next gradle plugin releases (after 2.4.0-alpha7)
2. using legacy (i.e. support) multidex, we'll have to wait until a new release of com.android.support:multidex:1.0.x library
Do I have that right?
ga...@google.com <ga...@google.com> #29
dr...@gmail.com <dr...@gmail.com> #30
This causes quite a bit of pain for my team. We currently have a test apk with more than 65k referenced methods (we're already running proguard on the test apk), and we're depending on it building properly. Our minSdkVersion is 18, but we only run our instrumentation tests on API 21+, so the old behavior allowed us to continue running our tests.
With the new behavior in AGP 3.0, our test apk fails to even build. It seems like my only options are:
1) Reduce the number of referenced methods
2) Create a new variant or flavor with minSdk 21+ and use that for running tests
3) Use minSdk 21 for all debug builds
The first option isn't really feasible, and the second is massively painful because it requires us to retrain 50+ devs on which gradle commands to use to run tests (since the commands change when adding a variant or flavor). The third option also isn't ideal because then we lose lint validation for our real minSdkVersion and lose the ability to easily run debug builds on older android versions manually.
Is there any way to keep the behavior from AGP 2.3.x for building test apks until a proper solution for legacy multidex is available?
jw...@gmail.com <jw...@gmail.com> #31
dr...@gmail.com <dr...@gmail.com> #32
ma...@gmail.com <ma...@gmail.com> #33
since the multidex 1.0.2 is live I would expect that multidex works fine on api <21 for test apks, but this is not the case.
Did I misunderstand something when you said this will be backported to legacy multidex so test apk can contain multiple dex files also or?
classpath 'com.android.tools.build:gradle:3.0.0-alpha7'
multidex : '1.0.2',
Android Studio 3.0 Canary 7
Build #AI-171.4182969, built on July 14, 2017
JRE: 1.8.0_152-release-884-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.4
ga...@google.com <ga...@google.com> #34
ma...@gmail.com <ma...@gmail.com> #35
Thank you for the answer but I don't understand what is inside multidex 1.0.2 then.
in support lib Revision 25.4.0 it is stated:
Concurrent with this support library release, we are also releasing multidex version 1.0.2. This version includes the following important changes:
Allows multidexing of instrumentation APK.
Deprecates MultiDexTestRunner (AndroidJUnitRunner should be used instead).
We use multidex 1.0.2. Does this mean this fix will come out in 1.0.3, do you have any eta window on this topic?
Cheers
ga...@google.com <ga...@google.com> #36
ma...@gmail.com <ma...@gmail.com> #37
Looking forward to the integration let us know when you manage to merge it.
Have a nice weekend!
ga...@google.com <ga...@google.com> #38
ma...@gmail.com <ma...@gmail.com> #39
thank you
ga...@google.com <ga...@google.com> #40
ma...@gmail.com <ma...@gmail.com> #41
does this mean this will come out with beta4?
ga...@google.com <ga...@google.com> #42
ja...@gmail.com <ja...@gmail.com> #43
Simply create a "CustomerTestRunner" and override "onCreate" to call "MultiDex.installInstrumentation(context, targetContext)". See this example:
ja...@gmail.com <ja...@gmail.com> #44
yo...@gmail.com <yo...@gmail.com> #45
st...@gmail.com <st...@gmail.com> #47
Can anyone give us an update and an ETA for this ?
We use build tools 26.0.1, gap 3 beta 5, ASTL runner 1.0.1.
st...@gmail.com <st...@gmail.com> #48
ja...@gmail.com <ja...@gmail.com> #49
run new tests.
Jared Burrows
*jaredsburrows@gmail.com <jaredsburrows@gmail.com>*
LinkedIn:
On Thu, Sep 14, 2017 at 12:14 PM, <buganizer-system@google.com> wrote:
dr...@gmail.com <dr...@gmail.com> #50
st...@gmail.com <st...@gmail.com> #51
st...@gmail.com <st...@gmail.com> #52
je...@google.com <je...@google.com> #53
ja...@gmail.com <ja...@gmail.com> #54
[Deleted User] <[Deleted User]> #55
za...@gmail.com <za...@gmail.com> #56
[Deleted User] <[Deleted User]> #57
le...@gmail.com <le...@gmail.com> #58
ga...@google.com <ga...@google.com> #59
ja...@gmail.com <ja...@gmail.com> #60
vy...@pinterest.com <vy...@pinterest.com> #61
cm...@google.com <cm...@google.com>
gl...@fitbit.com <gl...@fitbit.com> #62
cm...@google.com <cm...@google.com> #63
All the changes needed are submitted to the four components (build tools, MultidexTestRunner, AndroidJunitRunner and android gradle plugin) and we'll update this bug as soon as it is released, so it will be in Android Gradle Plugin 3.1.
Note that both the deprecated MultiDexTestRunner and the replacement AndroidJUnitRunner will support legacy multidex test APKs
sz...@gmail.com <sz...@gmail.com> #64
Doing it in 3.1 will require everyone who wants to have multidex for test APK working to start using unstable version of AS and AGP.
zt...@gmail.com <zt...@gmail.com> #65
> `Using multidex to create a test APK is not currently supported.`
cm...@google.com <cm...@google.com>
ga...@google.com <ga...@google.com> #66
ja...@gmail.com <ja...@gmail.com> #67
an...@gmail.com <an...@gmail.com> #68
le...@gmail.com <le...@gmail.com> #69
[Deleted User] <[Deleted User]> #70
[Deleted User] <[Deleted User]> #71
[Deleted User] <[Deleted User]> #72
ga...@google.com <ga...@google.com> #73
You need to use Android plugin for Gradle 3.1.0-alpha04+, any compatible version of Gradle (e.g. 4.4) and BuildTools (e.g. 27.0.3). Multidex library 1.0.2 will be added by the plugin as a dependency automatically. With this, your build will be successful.
To run tests successfully, the test runner needs to support legacy test APK. AndroidJUnitRunner supports that, so you can use that.
ma...@gmail.com <ma...@gmail.com> #74
For example following your suggestion of tl;dr version the test crashes because some files are not found in the main dex file during the app start:
01-09 10:31:06.965 4861-4861/? W/dalvikvm: Class resolved by unexpected DEX: Ltimber/log/Timber$Tree;(0xa75def58):0x99f02000 ref [Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;] Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;(0xa75def58):0x99caf000
01-09 10:31:06.965 4861-4861/? W/dalvikvm: (Ltimber/log/Timber$Tree; had used a different Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension; during pre-verification)
01-09 10:31:06.965 4861-4861/? D/AndroidRuntime: Shutting down VM
01-09 10:31:06.965 4861-4861/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa66de228)
01-09 10:31:06.975 4861-4861/? E/InstrumentationResultPrinter: Failed to mark test No Tests as finished after process crash
01-09 10:31:06.975 4861-4861/? E/MonitoringInstr: Exception encountered by: Thread[main,5,main]. Dumping thread state to outputs and pining for the fjords.
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
at timber.log.Timber$Tree.getStackTraceString(Timber.java:569)
at timber.log.Timber$Tree.prepareLog(Timber.java:544)
at timber.log.Timber$Tree.i(Timber.java:452)
at timber.log.Timber$1.i(Timber.java:288)
at timber.log.Timber.i(Timber.java:63)
Do you have any idea where does this pops out from?
ga...@google.com <ga...@google.com> #75
This seems to be Java 8 specific bug, and I've filled
st...@gmail.com <st...@gmail.com> #76
fu...@gmail.com <fu...@gmail.com> #77
[Deleted User] <[Deleted User]> #78
[Deleted User] <[Deleted User]> #79
[Deleted User] <[Deleted User]> #80
Until recently we had a big module, with all our code + all our instrurmentation tests code. Then we could check and the plugin (3.1.alpha and 3.1) work well to enable multidex in tests apks.
But we recently dissociated this big module: one contains the production code, the other one contains the instrumentation code. And then, the new plugin breaks: we can still a multidex production app, but the instrumentation test apk is not generated. We hit the 65K limit and the build reports this as an issue. Also, the android test don't have a task: transformClassesWithMultidexlistFor<variant>AndroidTest
What can go wrong ?
[Deleted User] <[Deleted User]> #81
* a few classes in production code
* quite a lot of classes of instrumentation tests
The module_apk wires together all other modules that are all library modules.
When adding multidexEnabled to module_apk, the production apk is multidexed, but not the test apk. There is no transform / task for the AndroidTest variant related to multidex.
When adding multidexEnabled to all default configuration of all modules, all of them have both instrumentation and production multidex tasks & transformations, all except module_apk...
We have no idea what is going wrong.
ga...@google.com <ga...@google.com> #82
I've filled
[Deleted User] <[Deleted User]> #83
Execution failed for task ':app:transformClassesWithMultidexlistForLive'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.
ga...@google.com <ga...@google.com> #84
pe...@layer.com.c-02odbdyf.appstempdomain.goog <pe...@layer.com.c-02odbdyf.appstempdomain.goog> #85
pa...@gmail.com <pa...@gmail.com> #86
ga...@google.com <ga...@google.com> #87
Yes, please file a new bug, and paste the link here. Issue in #78 was due to a custom plugin which would disable multidex. Thanks!
Description
Build #AI-171.3870562, built on April 1, 2017
JRE: 1.8.0_112-release-b736 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
gradle-3.4.1
classpath 'com.android.tools.build:gradle:2.4.0-alpha4'
buildTools : '25.0.1',
compileSdk : 25,
javaVersion: JavaVersion.VERSION_1_8,
minSdk : 16,
targetSdk : 25
Multidex is setup and works fine (compile, assemble and espresso test) with:
classpath 'com.android.tools.build:gradle:2.3.0'
When we bump up to 2.4 alpha 4 we get multidex issue when we try to run the tests:
(I repeat multidex is setup properly and everything works fine on plugin 2.3.0)
This is a scaffold-like very close to our project setup that I created to reproduce various gradle issues we encounter with our enteprise project:
(sadly I did not update it and maintain it in some time I can refresh it if you really need it or feel free to fork or PR)
This is the stacktrace of the issue
This is the command I ran on our project (should be the same on example project I attached)
./gradlew clean connectedNonpayUnitedStatesBleedingDebugAndroidTest --stacktrace
but I repeat I do not know yet does that project compiles even with the new plugin I can update it later on if you need it.