Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate APKLIB of compatibility-v7-appcompat

I want to start using the new ActionBar of the appcompat-v7 support library, and I'm using maven. I tried to create an apklib. These are the steps I followed:

  1. Create a ZIP file of the project android-sdks/extras/android/support/v7/appcompat
  2. Rename the ZIP file with an APKLIB extension.
  3. Install the APKLIB file into my local repository:

C:....m2\repository\android\support\compatibility-v7-appcompat\18>mvn install:install-file -Dfile=appcombat.apklib -DgroupId=android.support -DartifactId=appcompat -Dversion=18 -Dpackaging=apklib

Start using the library from my android project adding this dependency in the pom:

    <dependency>
        <groupId>android.support</groupId>
        <artifactId>appcompat</artifactId>
        <version>18</version>
        <type>apklib</type>
    </dependency>

But it's not working. I'm getting an error of missing artifact.
Any help would be much appreciated.

like image 778
nano Avatar asked Aug 24 '13 14:08

nano


People also ask

What is AppCompat V7 in Android?

Android AppCompat Library V7 The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.

How do I add the V7 AppCompat support library to my project?

In the Properties window, select the "Android" properties group at left and locate the Library properties at right. Select /path/to/appcompat/ and Click Remove. Click Add to open the Project Selection dialog. From the list of available library projects, select v7 appcompat library and click OK.

What is AppCompat in Android?

When new versions of android are published, Google will have to support the older versions of android. So AppCompat is a set of support libraries which can be used to make the apps developed with newer versions work with older versions.


2 Answers

The is a way to install appcompat into your local repository without relying on Maven SDK deployer...

From the Android SDK Manager, install the 'Android Support Repository' option. go into your SDK folder, then into ./extras/m2Repository/com/android/support/appcompat-v7/18.0.0

open the appcompat-v7-18.0.0.aar file and copy the classes.jar out to a file named appcompat-v7-18.0.0.jar

at the command line go into the same m2Repository folder and run the following commands:

mvn install:install-file -Dfile="./com/android/support/appcompat-v7/18.0.0/appcompat-v7-18.0.0.jar"/ -DpomFile="./com/android/support/appcompat-v7/18.0.0/appcompat-v7-18.0.0.pom"/ -Dpackaging="jar"
mvn install:install-file -Dfile="./com/android/support/appcompat-v7/18.0.0/appcompat-v7-18.0.0.aar"/ -DpomFile="./com/android/support/appcompat-v7/18.0.0/appcompat-v7-18.0.0.pom"/ -Dpackaging="apklib"

Then add the following two dependencies in your project's POM

    <dependency>
        <groupId>com.android.support</groupId>
        <artifactId>appcompat-v7</artifactId>
        <version>18.0.0</version>
        <type>apklib</type>
    </dependency>
    <dependency>
        <groupId>com.android.support</groupId>
        <artifactId>appcompat-v7</artifactId>
        <version>18.0.0</version>
        <type>jar</type>
    </dependency>
like image 54
dangVarmit Avatar answered Nov 10 '22 01:11

dangVarmit


The apklib generated with maven-android-sdk-deployer works fine for me.

https://github.com/mosabua/maven-android-sdk-deployer

like image 22
kassim Avatar answered Nov 10 '22 01:11

kassim