How to create a release android library package (aar) in Android Studio (not debug)

后端 未结 9 804
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-02 07:50

I have built my android library package (aar) and the result of build is created in \"..\\app\\build\\outputs\\aar\" folder. The file within this folder is called \"app-deb

相关标签:
9条回答
  • 2020-12-02 08:18

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

    0 讨论(0)
  • 2020-12-02 08:18

    for me, simply fixing a layout bug in the library that did not produce compile error (missing androidx plugin) fixed it and <lib>-release.aar appeared alongside the <lib>-debug.aar in build/outputs/aar/ folder.

    0 讨论(0)
  • 2020-12-02 08:28

    I faced this issue in AS 2.3.3 and solved it by changing the build variant of the module to release and building it again:

    0 讨论(0)
  • 2020-12-02 08:28

    You can use command line

    ./gradlew <moduleName>:assemble
    
    ./gradlew <moduleName>:assemble<build_variant>
    //for example
    ./gradlew <moduleName>:assembleRelease
    
    //or
    ./gradlew <moduleName>:bundle<build_variant>Aar
    //for example
    ./gradlew <moduleName>:bundleReleaseAar
    
    //output is located
    <project_path>/build/outputs/aar/<module_name>-<build_variant>.aar
    

    Alternatively you can use AndroidStudio UI

    View -> Tool Windows -> Gradle
    <module_name> -> Tasks -> build or others -> assembleRelease
    
    
    0 讨论(0)
  • 2020-12-02 08:31

    With Android Studio 3.0 is easier to generate aar file. From the Gradle option, chek for the option as shown in the picture

    0 讨论(0)
  • 2020-12-02 08:32

    In Android Studio 1.2+, there is a complete gradle menu that lists all of the available gradle tasks.

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

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

    Right click the task you want and click "Run".

    Right click the task you want a click "RUN"

    0 讨论(0)
提交回复
热议问题