search

Home  >  Q&A  >  body text

Will importing dependencies in android studio increase project size?

I want to know if importing too many dependencies into studio will make the project larger? What is the proportion of increase? I import 6 dependencies into a 100M project, so what is the approximate size of the dependencies in 100M?

世界只因有你世界只因有你2732 days ago990

reply all(3)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-06-27 09:21:11

    It will become larger, but generally dependencies will use ProGuard to clean up those codes that are not called. Remember to add the obfuscation rules of that library to the corresponding dependencies.

    reply
    0
  • PHP中文网

    PHP中文网2017-06-27 09:21:11

    Depends on how you provide dependencies

    compile testCompile providedetc

    reply
    0
  • 某草草

    某草草2017-06-27 09:21:11

    First explain how to import dependencies, and then "the project becomes larger" refers to the source code or the compiled APK. Gradle is generally used more now, but jar packages, aar packages, and so libraries are also preferred. ; Gradle directly changes the configuration, and the following ones directly import files, which can be regarded as the same method.
    Import file: The size of the imported file can be understood as how much the project has increased. The size of the imported code can be different, As for the proportion, it is necessary to compare the size of the imported file with the original size of the project. It is a specific value that can be calculated based on the specific project and the imported file (it seems useless). The same is true for the proportion of dependent files. As for the generated APK, because the imported file will be compiled and compressed, the size of the imported file will not be the same as the size of the APK. In fact, you can first compile the version without added dependencies to get the Apk file; and then combine it with the file generated after adding the dependencies. Compare the sizes, so you can get how much of the Apk size the imported files account for. Of course, there is a positive correlation between the size of the imported files and the increased file size of the apk after generation (you are bigger and I am also bigger).
    Gradle method: Changed a few lines of configuration , the project code increases by dozens of bytes. However, the complete code will be downloaded when compiling, that is, the Apk size changes during compilation in the same way as the imported file.

    reply
    0
  • Cancelreply