Can't import project to android studio

后端 未结 4 1680
抹茶落季
抹茶落季 2021-01-13 01:05

I\'m trying to use this library

I\'ve added

compile \'net.rdrei.android.dirchooser:library:2.0@aar\'

to dependecies.

My top

相关标签:
4条回答
  • 2021-01-13 01:11

    After trying the answer by Gabriele and a bit more digging, this worked for me

    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
        maven { url 'http://guardian.github.com/maven/repo-releases' }
    }
    
    dependencies {
        compile 'net.rdrei.android.dirchooser:library:2.2-SNAPSHOT@aar'
    }
    
    0 讨论(0)
  • 2021-01-13 01:20

    The answer provided by @unify @GabrieleMariotti and @AndyJoiner is correct. However it confused be since we have two gradle files - a project level gradle and a inner gradle (where you write your dependencies). The solution is to add the code suggested by @AndyJoiner inside your inner gradle.

    Since I was confused as to where to add the code, which took me an hour to figure out, I don't want it to happen to others. So, I am posting my both gradle files.

    Project Level Gradle

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.0.0'
        }
    }
    
    allprojects {
        repositories {
            jcenter()
        }
    }
    

    Inner Gradle

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 21
        buildToolsVersion "21.1.2"
    
        defaultConfig {
            applicationId "com.itcse.materialdesignsearchviewlikegoogleplay"
            minSdkVersion 15
            targetSdkVersion 21
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    // Add the code for repositories here
        repositories {
            mavenCentral()
            maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
            maven { url 'http://guardian.github.com/maven/repo-releases' }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:21.0.3'
    // Add the dependencies here
        compile 'com.quinny898.library.persistentsearch:library:1.0.0-SNAPSHOT@aar'
    
    }
    

    Hope this help others in future.

    0 讨论(0)
  • 2021-01-13 01:20

    This worked for me:

    repositories {
       maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } 
    

    You can find the repository here https://oss.sonatype.org/#nexus-search;quick~dirchooser

    0 讨论(0)
  • 2021-01-13 01:36

    This library is not on Central Maven as aar.

    Check here:

    http://search.maven.org/#search%7Cga%7C1%7Cnet.rdrei.android.dirchooser it is an apklib format.

    I've checked the snapshots repo, and here you can find this library.

    https://oss.sonatype.org/content/repositories/snapshots/net/rdrei/android/dirchooser/library/

    To use the snap repo you have to change your script:

    repositories {
        mavenCentral()
        maven {
            url "https://oss.sonatype.org/content/repositories/snapshots"
        }
    }
    

    Then add you depencency, for example

    compile 'net.rdrei.android.dirchooser:library:2.1-SNAPSHOT'
    
    0 讨论(0)
提交回复
热议问题