0

Been searching around and cant figure out how to export my library module. Apparently AAR is the Android standard that exports thew resources too, which I want.

After looking here I figured how to do it, exported etc. I copied to desktop and extracted it (as its more or less a zip) but i couldnt find my classes.

Not really sure what ive done or missed?

my build gradle has the following.

apply plugin: 'com.android.library'

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.0'

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile ('com.android.support:appcompat-v7:22.0.0')
}

Android studio advised to change to 'com.android.library'

Any ideas how I can successfully extract with all my library classes and resources?

Note: I also rebuild and clean (apparently this should generate a new AAR file?) maybe this is not the correct way to do it?

Community
  • 1
  • 1
Kurdish Droid
  • 279
  • 3
  • 15
  • What is the AAR file for? If you are going to consume this in some other app, perhaps this library should just be a module of that app's project. If you are going to publish this AAR in some artifact repository, use the `maven` plugin and its `uploadArchives` task. There is very little use to a plain AAR file on its own IMHO. – CommonsWare Apr 04 '15 at 15:14
  • The generated .aar file is at location YOUR_LIB_MODULE>build>output>aar. Did you check there ? – Nishant Srivastava Apr 04 '15 at 15:14
  • @radix that is where I have been looking. – Kurdish Droid Apr 04 '15 at 15:15
  • @CommonsWare the AAR will be used to be distributed to others. After research I thought this was the way forward? so I should use maven plugin? – Kurdish Droid Apr 04 '15 at 15:15
  • I guess then you should create a AAR Library module via the New Module Command under File, Rebuild Project and then check inside your Lib Module Folder. – Nishant Srivastava Apr 04 '15 at 15:17
  • If i am not wrong you have just the app Module in your project right..? – Nishant Srivastava Apr 04 '15 at 15:17
  • "the AAR will be used to be distributed to others" -- then IMHO you should be looking into setting up an artifact repository, or using an existing one (Maven Central, JCenter, your enterprise's internal repository, etc.). Once you identify the repository that you want to use, you can set up the `maven` plugin to publish your library to it. – CommonsWare Apr 04 '15 at 15:18
  • @CommonsWare what would I have to do just to export it out and have it as a library that I would potentially use and pass to others manually? Could I possibly just copy the folder structure of the library and paste into another project? would that work? – Kurdish Droid Apr 04 '15 at 15:20
  • "what would I have to do just to export it out and have it as a library that I would potentially use and pass to others manually?" -- I have no idea, as that is not a recommended approach. – CommonsWare Apr 04 '15 at 15:21
  • @CommonsWare the thing is I dont want to publish the library yet. I just want to make sure I have a export of it. I havent seen anything of the sort to help me on the internet except for AAR which I read is a replacement of JAR. If I were to use the Maven plugin, do you know anywhere I could read on it and see how the plugin works? – Kurdish Droid Apr 04 '15 at 15:23
  • Not 100% sure but if you only have one library project in Android Studio, it may not always create aar when "building". Have you tried from command line: ./gradlew assemble (or gradlew.bat if on windows) and then checking /output/aar -dir - just to check that your build works? – Jukka Raanamo Apr 05 '15 at 14:42

0 Answers0