Difference between AAR, JAR, DEX, APK in Android

前端 未结 2 1209
滥情空心
滥情空心 2021-01-31 04:06

In Android systems or development enviroments, what are the differences between AAR, JAR, DEX, and APK files? What is the purpose of each one?

AFAIK, JAR are just like a

2条回答
  •  Happy的楠姐
    2021-01-31 04:37

    JAR are just like a collection of .class files (like in Java).

    That is because it is a Java JAR.

    AAR are JAR files + resources

    Correct.

    But what's its usage case? To be used to distribute development libraries for Android?

    Correct.

    APK seems to be similar to packages like .deb or .rpm. Is it the only way to install applications on Android?

    Generally speaking, yes.

    What about DEX files?

    DEX files contain the cross-compiled Dalvik bytecodes representing the application code. Developers write Java, but Android runs Dalvik bytecodes. In the APK, you will find a DEX file representing those bytecodes.

    Moreveor, when distributing .so (i.e. native code) files for Android, what's the best way to do it?

    I do not know what you mean by "distributing".

    If you mean "distributing an app", your .so files will be in the APK.

    If you mean "distributing as a library for other developers", use an AAR or just an Android project in source form.

提交回复
热议问题