Search code examples
androidandroid-studiojargradlecommonsware-cwac

How does gradle choose certain urls to look in for a repository? How do I point it in the right direction so that I can import this JAR?


In order to fetch the cwac-camera commonsware jar, I have this in build.grade:

dependencies {
    compile 'com.commonsware.cwac:camera:0.6.+'
}

when I try and compile, it gives me this:

Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
   > Could not find com.commonsware.cwac:camera:0.6.12.
     Searched in the following locations:
         https://jcenter.bintray.com/com/commonsware/cwac/camera/0.6.12/camera-0.6.12.pom
         https://jcenter.bintray.com/com/commonsware/cwac/camera/0.6.12/camera-0.6.12.jar
         file:/home/alex/android/android-sdk-linux/extras/android/m2repository/com/commonsware/cwac/camera/0.6.12/camera-0.6.12.pom
         file:/home/alex/android/android-sdk-linux/extras/android/m2repository/com/commonsware/cwac/camera/0.6.12/camera-0.6.12.jar
         file:/home/alex/android/android-sdk-linux/extras/google/m2repository/com/commonsware/cwac/camera/0.6.12/camera-0.6.12.pom
         file:/home/alex/android/android-sdk-linux/extras/google/m2repository/com/commonsware/cwac/camera/0.6.12/camera-0.6.12.jar
     Required by:
         Cwac4:app:unspecified

so its looking in jcenter, and in a bunch of my home directory files and failing to find anything. I think it should look on github as I know there are releases here: https://github.com/commonsguy/cwac-camera/releases, so how can I tell it that?

additionally, when I manually include the jar in one of my home directories for instance, it compiles with no errors, but using import com.commonsware.camera..(anything basically) results in "could not resolve symbol commonsware" errors. I take this to mean that I can't just manually put it somewhere and that perhaps android studio needs to see it in an official repository for it to allow importing it. Is this correct?

NOTE: I know that this library is slated to be rewritten. I would like to use it anyways if possible.


Solution

  • so how can I tell it that?

    Quoting the current version of the documentation:

    To integrate the core AAR, the Gradle recipe is:

    repositories {
        maven {
            url "https://repo.commonsware.com.s3.amazonaws.com"
        }
    }
    
    dependencies {
        compile 'com.commonsware.cwac:camera:0.6.+'
    }
    

    You appear to have added the dependencies but did not update your repositories.