How to create a package of the android version of the release (aar) in Android Studio (do not debug)

I created my Android library package (aar), and the build result was created in ".. \ app \ build \ output \ aar". The file in this folder is called "app-debug.aar", so I think it was built in debug mode, so I would like to know how to generate the released release, that is, "app-release.aar". How can i do this? In addition, is it possible to generate an assembly with a different user name, for example, "myCustomAppName-release.aar" instead of "app-release.aar".

+72
android android-studio android-library
Dec 25 '14 at 10:15
source share
5 answers

Android Studio 1.2+ has a full gradle menu that lists all the available gradle tasks.

I found this menu on the right side of the IDE with the default options enabled.

The gradle menu is on the right side of the IDE by default ...

Right-click the desired task and click Run.

Right click the task you want a click "RUN"

+110
Jul 07
source share

1.add after the script in your android tag {} in build.gradle to create the release assembly:

 signingConfigs { testConfig{ storeFile file("X:/XXXX/yourkeystore") storePassword "yourKeyPassword" keyAlias "yourAlias" keyPassword "yourAliasPassword" } } buildTypes{ release { signingConfig signingConfigs.testConfig minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } 

2.run command "gradle clean build" on the command line.

+8
Dec 25 '14 at 10:22
source share

This problem can already be handled with answers such as

 ./gradlew assembleRelease 

or select assembleRelease from the Android Studio Gradle menu . However, for completeness, with Android Studio 1.5.1 (and possibly also older versions), creating a version of the .aar version can be done by choosing Build → "Build APK" in Android Studio . It seems to be building. If your project contains only the library project, it does not request signing information.

+8
Feb 15 '16 at 12:00
source share

I ran into this problem in AS 2.3.3 and solved it by changing the module build option to create it again and again:

enter image description here

+8
Sep 07 '17 at 20:36 on
source share

Set up your project as an Android library
In the build.gradle file: plugin: 'com.android.library'
You can see the result: build/outputs/aar/[your module].
Also see Link

+3
May 04 '15 at 8:18
source share



All Articles