Android studio 2.3 generates aar instead of apk

2019-07-28 11:09发布

问题:

Build > Build APK generates aar instead of apk.

In the outputs folder I have only the aar folder:

My build.gradle android section:

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
    applicationId "my.cool.app"
    minSdkVersion 21
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true;
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
}

}

What can the problem?

回答1:

The problem is your Build APK is calling a wrong gradle function. Check your complie options in:

Android Studio / Preferences / Build, Executions and Deployment / Compiler

Also check your project configurations: