Why for the module you can create arr a for the app only apk ? What is the general difference between an app and a module? I don’t see any difference in gradle. But Android Studio somehow distinguishes them ...

enter image description here

 apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.android.myapplication" minSdkVersion 16 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' } 

.

 apply plugin: 'com.android.library' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 16 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' } 
  • one
    difference in the first line of the gradle config - pavlofff
  • Hmm ... you are right. For some reason I gave it a different meaning ... Can I somehow make arr with the application - Bogdan Shulga

2 answers 2

The aar format is the packaging format of the android library (Android Library Format) / Naturally, you can save the library into this format, not the application.

The type of output file is indicated by the line apply plugin , where respectively the library is indicated (library) or application (application)

You can make a library from your application (replace apply plugin: 'com.android.application' with apply plugin: 'com.android.library' ) and compile it into aar-format

    The first line is different:

    apply plugin: 'com.android.library' for module

    and

    apply plugin: 'com.android.application' for the application.

    • 3
      Daniel, it was necessary to write "The first line of Karl! The first line!" :) - Bogdan Shulga