Hi guys, i have a performance problems with my app...
# compose
g
Hi guys, i have a performance problems with my app. I have two mobile devices, an android 10 and an android 11, in my android 11 it goes very well but in my android 10 it goes very badly, I have been following all the rules of compose for better maintenance, but even so in one of the devices it goes very bad. What could I do?
1
a
Debug or release builds
c
release builds with r8. then id use the recomposition counter tool or the

compose trace tool

a
Yeah there’s a few ways. I was asking because of the difference in performance.
c
Yeah. I knew you were asking. I was more so just reinforcing to make sure its release with r8. 🙌
g
Copy code
I don't really understand what r8 is, I have to look at it, I've already been optimizing the recomposition count and I think that's not it anymore, it has to be something else
c
minifyEnabled = true in your build.gradle https://developer.android.com/studio/build/shrink-code but theres also some configuration you might have to do depending on what libraries you're using. but it mostly works out of the box.
a
Even without R8, there is a huge difference with release builds compared to debug.
g
Isn't it the same to "run" the app as to export it as an apk for release? (I've never done it, that's why I say) I always use "run" the green triangle
thanks to all, here it is time to go to bed, tomorrow I will look at it carefully because they are concepts that I still have to read to understand well.
minifyEnabled = true en su build.gradle how is it?
c
You want to change the build variant in AS to release. You can set the release build to build with debug keys when deployed from the IDE This is my release block
Copy code
release {
      // Enables code shrinking, obfuscation, and optimization
      isMinifyEnabled = true
      // Enables resource shrinking, which is performed by the Android Gradle plugin.
      isShrinkResources = true

      proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "<http://proguard-rules.pro|proguard-rules.pro>")
      // Allows developers to test a release variant directly from the IDE
      signingConfig =
          if (properties.containsKey("android.injected.invoked.from.ide")) {
            signingConfigs.getByName("debug")
          } else {
            signingConfigs.getByName("release")
          }
    }
g
Copy code
signatureConfig =
            if (properties.containsKey("android.injected.invoked.from.ide")) {
                firmConfigs.getByName("debug")
            } plus {
                firmConfigs.getByName("release")
            }

Is it useful to be able to run in release?
a
you are interested in this
If you want to test with an unsigned version, simply select release here and go to Build -> Build Bundles/APKs -> Build APK It will generate an apk that you can install using
adb install appname.apk
g
Copy code
with putting it in release as it says in the image and giving it to run, I would already be testing it in release? or do I have to do the build apk thing?
a
should be enough
g
ok i go to try it, thanks very much!
I just tried the release mode with the signed app and now it works quite well, I thank you all, but would it be correct to upload an app in which the debug mode has poor performance but in release it doesn't?
a
Apps are uploaded in release mode. If you are talking about play store, you won't even be allowed to upload the debug version.
g
so if the app works well (better) than in debug mode, I can upload it
a
not sure what do you mean x)
g
Copy code
If my app works fine in release, can I publish it on Google Play?
a
Yes
Check your DMs for more info about this stuff
g
how is DM?
c
debug builds CANT be put on play store. Only release builds. So the "fast" version will always be available to your users. Debug version of app has a bunch of debuggable options setup on your apk and so itll always be "slower". This was true even before compose.
a
A direct message (private message) here, in slack . Left panel of slack x) You mentioned before you had issues with english so I've sent you a brief summary about this stuff in spanish