Android dependencies : apklib vs aar files

From my understanding, apklib contains code + resource shared with Maven .
aar files are distributed by Gradle.

The aar differ from apklib in one major way : classes are compiled and included in a classes.jar in the root of the aar. Whereas apklib cannot contain compiled class files or jars.

  • androidTest AndroidManifest.xml ignored
  • How to check Viewpager item ids with Espresso?
  • Managing multiple asynctask to download multiple images from html code, leaking ram, any ideas?
  • ERROR: “Syntax error on token ”;“, , expected” Why?
  • in-app billing doesn't work: “IAB Helper is not set up”
  • Android: Remove all the previous activities from the back stack
  • 1 Can somebody explain the main differences between apklib vs aar files ?

    2 Can Maven use aar ? Can Gradle use apklib ?

    3 Which format is “better” ?

    Related posts:

    Fragment's onOptionsItemSelected doesn't get called
    Android Studio 2.3 doesn't have Test Instrumentation specifier in UI
    EditText: Center hint but have entered text start from top
    Hide ActionBar MenuItems when Navigation Drawer slides for any amount
    How to set my sms app default in Android Kitkat?
    Android bug in Slide Activity transition
  • Android 4.3 DeviceAdmin error for non owner profile
  • Hardware menu popup issue with Appcompat
  • Getting wifi broadcast address in Android wifi hotspot
  • Could not find com.google.android.gms:play-services:3.1.59 3.2.25 4.0.30 4.1.32 4.2.40 4.2.42 4.3.23 4.4.52 5.0.77 5.0.89 5.2.08 6.1.11 6.1.71 6.5.87
  • accepting click events in RelativeLayout
  • How to attach GestureDetector to a ListPreference?
  • One Solution collect form web for “Android dependencies : apklib vs aar files”

    1 Can somebody explain the main differences between apklib vs aar
    files ?

    Couple differences that comes to my mind, in addition to the one you said:

    1. aar can contain no source code and a java jar inside the libs folder in case you don’t want to provide the source code (like Google Play Services does);
    2. aar can contain custom proguard file and custom lint rules, although I’m not sure they are take into account at the moment.

    2 Can Maven use aar ? Can Gradle use apklib ?

    The Android Maven Plugin supports aar since version 3.7.0.
    Gradle doesn’t support using apklib dependencies but you could export your android-library as apklib (see this post).

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.