Hi I would love to know if the following dependenc...
# compose
w
Hi I would love to know if the following dependencies are necessary for a pure Jetpack Compose project :
Copy code
implementation 'androidx.core:core-ktx:1.3.2'
 implementation 'androidx.appcompat:appcompat:1.2.0'
 implementation 'com.google.android.material:material:1.3.0'
 implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0'
t
no they are not necessary. You just need: "androidx.activityactivity compose1.3.0-alpha03" And than just the libs from compose you are using.
๐Ÿ’ฏ 1
w
Thanks for your input ๐Ÿ‘
t
Than you have to use this code for Activity because the AppCompatActivity is not available:
Copy code
class MainActivity: ComponentActivity()
๐Ÿ‘ 2
w
yes I got it thanks again ๐Ÿ™‚
t
It saves apk size when you not using the appcompat stuff. In my app i am able to get an Apk size < 2mb. In the beginning of compose it was < 1mb but compose and also my app increased in size.
l
This is most likely because Compose currently has a dependency on appcompat and fragments - in the next release this will be removed so it should be a lot smaller
a
yeah those transitive dependencies were added for the alphas not because compose actually needs them, but because if you are using them elsewhere in your app, they need to be at least a particular version or newer for compose to not run into problems.
last I checked when these are stripped out, small apps post-r8 shrinking still have classes.dex files < 1MB. There's a lot in appcompat that r8 can't prove it can remove safely.
c
OOh. So in a pure compose app we can remove appcompat dependency completely?
๐Ÿ‘Œ 1
a
๐Ÿ‘๐Ÿผ 1
๐Ÿ‘ 1