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.

  • How to avoid total view-hierarchy re-layout when using EditText?
  • Send C++ string to Java via JNI
  • Loading package html + resources into webview
  • NotificationListenerService Implementation
  • WebView loadDataWithBaseUrl - weird issue in android 4.0.3
  • Android get current Locale, not default
  • 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:

    Cardview not showing shadow along bottom
    Set edittext using only “,0123456789” programmatically in Android?
    SimpleDateFormat warning To get local formatting use getDateInstance(), getDateTimeInstance(), or ge...
    CRITICAL_STRUCTURE_CORRUPTION BSOD Windows 8.1 with Intel HAXM Android Emulator installed
    Failed to install HelloAndroid.apk on device 'emulator-5554!
    Error: View not attached to window manager
  • Android - Creating a new activity in Eclipse
  • Convert string to date format in android
  • How to put views on top of an ImageView, in relation to the ImageView's content size?
  • What tools are available to test JobScheduler?
  • Lockscreen is displayed between activities
  • Android widget not showing up on the list after developed
  • 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.