user1611830
user1611830

Reputation: 4857

Issue with finding gradle built project

I am using some plugin actionbarpulltorefresh, but in my code PullToRefreshLayout is not resolved by the ide. Here's my build.gradle file, the problem is that I can't find any source file of this plugin, nothing in the .gradle directory

I have some build.gradle file this

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}

apply plugin: 'android'

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.github.chrisbanes.actionbarpulltorefresh:library:+'
}

android {
    compileSdkVersion 18
    buildToolsVersion '18'

    defaultConfig {
        targetSdkVersion 18
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

Edit : when I put

import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout; 
private PullToRefreshLayout mPullToRefreshLayout;

I get the message can not resolve symbol PullToRefreshLayout. I am using sat version intelliJ on which android studio is based

Upvotes: 1

Views: 271

Answers (1)

Scott Barta
Scott Barta

Reputation: 80010

You'll have better luck if you upgrade to new versions of everything:

  • Android Studio 0.4.3.
  • Android Gradle plugin 0.8. You'll have to edit the classpath in your build.gradle to:

    classpath 'com.android.tools.build:gradle:0.8.+'
    
  • Gradle 1.10. You'll have to edit the distributionUrl in your gradle/wrapper/gradle-wrapper.properties to:

    distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip
    
  • Download the 19.0.1 Android SDK Build Tools in the SDK Manager and instuct the build to use them with this in your build.gradle:

        buildToolsVersion '19.0.1'
    

There's a bug that was fixed in Android Studio 0.4.3 that I think is the cause of it not seeing the classes in your actionbarpulltorefresh library; the new version of the plugin and Gradle will be necessary for your project to work in 0.4.3. If you upgrade Android Studio it should detect the old versions of the plugin and Gradle and offer to change them for you, but if it doesn't, then you can edit by hand. It won't offer to update the build tools version; you'll have to do that yourself.

Upvotes: 2

Related Questions