Problems with importing libraries

Asked

Viewed 964 times

8

I started developing for Android in my work and I was asked to start exchanging some simple things from an existing project, which works and has even been released (the version I’m trying to test). But I can’t spin it at all.

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

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

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 believe that’s all that’s left for my application to run. But if it doesn’t work, there would be some better solution for me to be able to make work in Android Studio?

Here’s the code to 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 matter:

import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
  • 1

    Take a look at the answer to that question http://stackoverflow.com/questions/17040558/is-it-possible-to-add-apklibs-to-dependencies-with-intellij

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 Repository Maven, version 2.1.1 is only available in APKLIB format.

Due to the nature of the format, you can extract the APKLIB file and compile it as AAR, to then use in the project. This Stackoverflow response (in English) explains how to do it.

I suggest you also search other libraries of the type, as this seems to be outdated. Sites like Android Arsenal bring together several libraries and reusable projects.

0

To import libraries in a simpler way in android studio recommend right-clicking the app directory (which is in the tree of your project), then in Open Modues Settings. In the window that opens go to the Dependencies tab and click on the + sign in the upper right corner, then library dependecy. In the search box type a reference to your library ex.(chrisbanes, since it has many other libraries). In the list that appears select the one you need and click ok... It may take a while for him to import the library, because it downloads and installs everything for you automatically. Then just use the library import in your project.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.