Problems with importing libraries

8

I started developing for Android in my work and they asked me to start by changing some simple things from an already existing project, which works and has already been released (the version I'm trying to test). But I can not run it at all.

I was advised to create a new project and move everything from the old (which is not grandle-based) to this one. I did this and after some effort I was able to import the facebook and google libraries into the buid.grandle dependencies. My problem is with the com.handmark.pulltorefresh.library library which gives the same problems as the others before compiling, so I use the command:

compile 'com.github.chrisbanes.pulltorefresh:library:2.1.1'

The error appears:

  

Warning: Packaging for dependency   com.github.chrisbanes.pulltorefresh: library: 2.1.1 is 'apklib' and is   not supported. Only 'aar' libraries are supported.

I think this is only missing for my application to run. But if it does not work, would there be a better solution to make it work in Android Studio?

Here is the code for my buid.grandle:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.example.aevo.talk_talk"
        minSdkVersion 15
        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.1.1'
    compile 'com.google.android.gms:play-services:6.1.71'
    compile 'com.facebook.android:facebook-android-sdk:3.23.+'
    compile 'com.github.chrisbanes.pulltorefresh:library:2.1.1'

}

And what I want to import:

import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
    
asked by anonymous 22.05.2015 / 22:33

2 answers

1

The error in question informs you that the library you are trying to use does not have an AAR version, which is the only supported format. According to the Maven Repository , version 2.1.1 is only available in APKLIB format .

Because of the nature of the format, you can extract the APKLIB file and compile it as AAR, and then use it in the project. This response from StackOverflow explains how to do it.

I suggest that you also search for other libraries of the type, as this seems to be outdated. Sites such as Android Arsenal bring together various libraries and reusable designs.

    
17.02.2016 / 17:15
0

To import libraries more simply in android studio I recommend right-clicking the app directory (which is in the tree of your project), then in Open Modems Settings. In the window that opens go to the Dependencies tab and click the + sign in the upper right corner, then library dependecy. In the search box enter a reference to your ex library (chrisbanes, since it has many other libraries). In the list that appears select the one that you need and click on ok ... It can take a while until it imports the library, why and download it and install everything for you automatically. Then just use the library import in your project.

    
24.05.2015 / 23:45