Status Update
Comments
om...@gmail.com <om...@gmail.com> #2
Branch: androidx-main
commit a330c0d3bcdd41326f37968a60e6084ad4a2e32c
Author: Chet Haase <chet@google.com>
Date: Wed Jul 05 07:26:46 2023
Convert APIs using PointF to use Float instead
PointF is a convenient mechanism for passing around x.y values
representing 2D points. But there are downsides, including:
- Converting to PointF: You may not have the data in PointF form
to begin with, so using an API which takes PointF requires converting
the data to that form (including allocating a PointF object every time)
- Mutability: Point structures can be mutated internally, causing
unpredictability in what that mutation means. Should the library
react to those changes? Ignore them? Do defensive copies (requiring
even more allocations)? Using primitive types like Float make the
behavior more obvious (by making the data inherently immutable).
- Allocations: Whenever we use object types, there are necessarily
allocations on the Java heap for them. This puts pressure on the GC
at both allocation and collection time. Given the amount of points
being passed around (especially at morph creation time, when curves
are being split and created), this causes a lot of PointF objects to
be allocated (even temporarily). Using Float avoids that problem.
Also fixed bug with unclosed paths causing discontinuity at the
start/end point.
Bug: 276466399
Bug: 290254314
Test: integration and unit tests pass
Relnote: PointF parameters changed to Float pairs
Change-Id: Id4705d27c7be31b26ade8186b99fffe2e2f8450e
M graphics/graphics-shapes/api/current.txt
M graphics/graphics-shapes/api/restricted_current.txt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicShapeTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/CubicTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonMeasureTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/PolygonTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/RoundedPolygonTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/ShapesTest.kt
M graphics/graphics-shapes/src/androidTest/java/androidx/graphics/shapes/TestUtils.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Cubic.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/CubicShape.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FeatureMapping.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/FloatMapping.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Morph.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/PolygonMeasure.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/RoundedPolygon.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Shapes.kt
M graphics/graphics-shapes/src/main/java/androidx/graphics/shapes/Utils.kt
M graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/DebugDraw.kt
M graphics/integration-tests/testapp-compose/src/main/java/androidx/graphics/shapes/testcompose/ShapeEditor.kt
M graphics/integration-tests/testapp/src/main/java/androidx/graphics/shapes/test/MaterialShapes.kt
b9...@gmail.com <b9...@gmail.com> #3
yu...@gmail.com <yu...@gmail.com> #4
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.graphics:graphics-shapes:1.0.0-alpha04
ae...@google.com <ae...@google.com> #5
aurimas@, are you the right person for triaging Android Studio version-specific issues? I saw you upgraded AndroidX to Bumblebee Canary 3 last week. This bug report might be specific to Bumblebee Canary 4, I'm not certain.
au...@google.com <au...@google.com> #6
Tested this quickly locally, it seems that the studio template creates a project that crashes out of the box. Updating compose_version to 1.0.0-rc02
and kotlin-gradle-plugin to 1.5.10
fixed the crash for me locally. We likely want to update studio template to use the latest of compose and kotlin.
au...@google.com <au...@google.com> #7
Moving to studio component for triage.
This is a pretty bad user experience so ccing annachiarab@ to make sure this gets attention
au...@google.com <au...@google.com> #8
It is likely to be addressed ag/Iafc18b104ff77fcd513d35db224d48f3b915a4e3
ky...@gmail.com <ky...@gmail.com> #9
I am running into this same issue on a project using compose 1.0.0-rc02, kotlin-gradle-plugin 1.5.10, AGP 7.1.0-alpha04, and AS 2021.1.1 Canary 4. It is only when I install app from AS. When I build from gradle via command line, I can run the app just fine.
b9...@gmail.com <b9...@gmail.com> #10
om...@gmail.com <om...@gmail.com> #11
I test the case #9 describe with 1.0.0-rc01
and 1.0.0-rc02
It turns out that it is not related to the compose_version.
If you build from gradle via command line, it will just works fine.
But run in IDE it will crash.
go...@maax.gr <go...@maax.gr> #12
ma...@gmail.com <ma...@gmail.com> #13
I don't think this is an Android Studio issue. I updated three existing projects to AGP 7.1.0-alpha04 and all of them broke. They all throw the exception listed in the original report.
If I roll each project back to AGP 7.1.0-alpha03 they all work again, even if I build from AS Bumblebee 2021.1.1 Canary 4.
It certainly seems to be an AGP issue, to me.
ga...@google.com <ga...@google.com> #14
I'm able to reproduce, looking into it now.
ga...@google.com <ga...@google.com> #15
The issue is that AGP passes min api level 21 to D8 causing it to remove the default methods from DefaultLifecycleObserver
(make them abstract) but it does not pass desugaring classpath when rewriting invocations in AndroidComposeView.onAttachedToWindow
.
b9...@gmail.com <b9...@gmail.com> #16
Another workaround is to change the deploy option from Default APK
to APK from app bundle
, then we could deploy to device via Android Studio.
ga...@google.com <ga...@google.com> #17
Current workaround is to (temporarily) increase your minSdkVersion
to 24+ in build.gradle
file.
jo...@gmail.com <jo...@gmail.com> #18
This issue isn't related to Canary 4. I had this issue with Canary 4 but uninstalled it and then installed Arctic Fox (2020.3.1) RC 1 and this issue was still there. Changing the minSdkVersion to 24+ does fix the problem.
ga...@google.com <ga...@google.com> #19
To clarify, the issue is not in Android Studio (the IDE), but it is in the Android Gradle plugin.
b9...@gmail.com <b9...@gmail.com> #20
ga...@google.com <ga...@google.com> #21
This is because when building from the IDE, AGP knows the API of the device which is used for deployment. This information is used to optimize the dexing pipeline (e.g avoid desugaring unless you run on device 23-). In AGP 7.1.0-alpha04 we introduced a bug where:
- the api version used for dexing is
minSdkVersion
e.g 21 - because we deploy to a device 24+ (e.g 30), desugaring is not requested
This means that D8 (dex compiler) will strip interface method and make them abstract, but it will not perform full rewriting, which leads to AbstractMethodError
.
When building from the command line, minSdkVersion used for dexing and deciding if desugaring should be performed is the same, so that's why you see no issues.
b9...@gmail.com <b9...@gmail.com> #22
ga...@google.com <ga...@google.com> #23
This will be fixed in AGP 7.1.0-alpha06. Until that version is released, you can use workarounds from #21.
Change id: Ifcdc39995ff4f05c4bdfd4622127e15dd0f33d4d
ma...@aexp.com <ma...@aexp.com> #24
This also seems to happen in Bumblebee Canary 3 with Compose 1.1.0-Beta01.
ga...@google.com <ga...@google.com> #25
Re #24: Can you please file a separate issue with a sample project, idea.log, build output, and logcat crash info?
fr...@daon.com <fr...@daon.com> #26
ga...@google.com <ga...@google.com> #27
Re #26: This issue should be fixed in AGP 7.1.3. Can you please file a new bug with details listed in #25?
be...@crisalid.com <be...@crisalid.com> #28
Is there any similar report that isn't 1 or 2 years old?
sh...@gmail.com <sh...@gmail.com> #29
I have error please fix it with YouTube premium
be...@gmail.com <be...@gmail.com> #30
ga...@google.com <ga...@google.com> #31
Re #30: Can you please file a separate issue with a sample project that reproduces the bug? See
be...@gmail.com <be...@gmail.com> #32
I could fix the problem by upgrading minSdkVersion from 21 to 24. But, it's not the fix I wanted. I didn't understand the #21 workaround. Can you explain more about?
Description
Jetpack Compose release version:
1.0.0-rc01
Android Studio Build:
Emulator Version:
30.8.1
Device:
Steps to Reproduce:
And it will crash, with those logs: