2

I have downloaded a file from our nexus server by following this post: gradle - download and unzip file from url in my android project, first specifying the target:

compile 'net.myapp.gwt:MyAppGWT:1.0:android@zip'

and then I have this unzip task:

task unzip(type: Copy) {

    def zipPath = project.configurations.compile.find {it.name.startsWith("net.myapp.gwt")}
    println zipPath
    def zipFile = file(zipPath)
    def outputDir = file('src/main/assets/')

    from zipTree(zipFile)
    into outputDir
}

The problem is that the line

project.configurations.compile

generates the weirdest error. Applying it gives me following error:

Error:Could not find com.android.support:appcompat-v7:23.0.1.
Searched in the following locations:
file:/Applications/AndroioStudio.app/Contents/gradle/m2repository/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom
file:/Applications/AndroidStudio.app/Contents/gradle/m2repository/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar
https://maven.fabric.io/public/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom
https://maven.fabric.io/public/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar
https://nexus.domain.net/content/repositories/apps-releases/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.pom
https://nexus.domain.net/content/repositories/apps-releases/com/android/support/appcompat-v7/23.0.1/appcompat-v7-23.0.1.jar
Required by:
apps-android:app:unspecified

Please install the Android Support Repository from the Android SDK Manager.
<a href="openAndroidSdkManager">Open Android SDK Manager</a>

Now, all of a sudden it can't find

com.android.support:appcompat-v7:23.0.1

which isn't a problem if I remove that line.

Community
  • 1
  • 1
peuhse
  • 1,688
  • 2
  • 20
  • 32
  • Interesting. I will try it out as soon as I get right permissions to our nexus server! – peuhse May 12 '16 at 14:27
  • It did work. I would like to tribute you to the right answer, so if you like you can post your comment as an answer and I give you credit for it (rather than me posting the answer to my own question). – peuhse May 16 '16 at 19:37

2 Answers2

1

@RaGe was right. Adding the libraries to our local repo server did the trick. Even though, as you state, this is a workaround and perhaps in the long run would be nice to find a better solution.

peuhse
  • 1,688
  • 2
  • 20
  • 32
0

appcompat comes from your local sdk folder. But when you try to access configs.compile, gradle is trying to resolve all dependencies including appcompat from the external repos, and fails when it (unsurprisingly) doesn't find appcompat.

I'm not sure what the "right" solution is, but a possible workaround is to publish android sdk dependencies to your local maven or nexus repo. Here's one way to do that: github.com/simpligility/maven-android-sdk-deployer

Some answers from here might help too.

Lastly, it might be possible to treat your SDK folder as a local maven repo. See here.

Community
  • 1
  • 1
RaGe
  • 22,696
  • 11
  • 72
  • 104