Unzip downloaded file in gradle downloaded from own nexus server - android

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.
Open Android SDK Manager
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.

#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.

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.

Related

Jar file in parse sdk android studio

I am trying to setup parse server in android studio.the problem which i face i am not able to found parse jar file and how i add in lib folder??
where I found jar file how we connect with parse server
I refer this tutorial http://brainwashinc.com/2017/02/17/setting-parse-sdk-android/
Downloaded SDK
Put jar file in ‘libs’ dir same level as project ‘java’ dir under src/main
Added Gradle line for jar file to build.gradle (for app module, not project):
I notice the guide you linked doesn't mention specifying the fileTree for jars.
In your module-level build.gradle, make sure you have this line:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
...
}
This will tell gradle that it should look for .jar files in the libs directory. Without this line, gradle has no way of finding your jar file.
Please let me know if this solves your issue!
The tutorial you are referring to is very old (according to the url path), and contains outdated steps for importing Parse SDK into Android project.
So to answer your question and add little background:
where I found jar file how we connect with parse server
Parse stopped distributing SDK .jar artifacts in 2017, so there is no .jar file to download. (I'm not counting old artifacts still hanging around JFrog's Bintray) More background info here.
The current way of importing Parse SDK is to add it as a gradle dependency.
Since they're distributing artifacts via Jitpack, which is not included by default in new Android Studio project, you must add this to your root build.gradle.
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
And then add the library to your module build.gradle (In most cases this would mean app/build.gradle). You can find latest version on Jitpack project page.
dependencies {
implementation "com.github.parse-community.Parse-SDK-Android:parse:latest_version"
}
For more information and to avoid similar problems with outdated instructions, I recommend reading the official docs.

404 could not find resource lint-gradle-26.1.3.pom

trying to build a signed apk from a opensource android application and got the error for the link https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.3/lint-gradle-26.1.3.pom is not accessible
i try to put this link manually to my browser and after redirecting to https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/tools/lint/lint-gradle/26.1.3/lint-gradle-26.1.3.pom?referrer link i got 404 could not find resource Error.
is something wrong with the repository? how can i fix this, i can reach the jar file from maven repository but gradle decides to get this from jCenter and hit this error and i can't remove jcenter from repository
I couldn't find out what is wrong but i find a workaround that sort of solve the problem.
I added this line to dependencies section of build.gradle file:
compile group: 'com.android.tools.lint', name: 'lint-gradle', version: '26.1.3'
somehow when gradle tries to fetch this jar in build process it fails and not going to fetch from google() repo (i have this in my repos) but it had no problem getting it when i specify it on dependencies. after it downloads i removed it from my dependencies and build used it's cached jar file and everything works now.

Error:(44, 13) Failed to resolve: org.achartengine:achartengine:1.2.0 [duplicate]

I have to create an application that makes extensive use of charts.
Reading the web I chose achartengine that seems to have everything I need.
I downloaded the jar file, I plugged in the libs folder, I selected "add to library" and I lunch the gradlew clean.
Result in the sources where I do the import of org.achartengine.xxxx I always returned the error that fails to resolve symbols .
Do you have suggestions?
Thank you
Andrea
I am able to use this library in my Android Studio project, this topic explains how to add AChartEngine repo to your project.
What I did:
Added following to project-wide build.gradle (one from the project root):
allprojects {
repositories {
...
maven {
url "https://repository-achartengine.forge.cloudbees.com/snapshot/"
}
}
}
For every module that uses the library, add this to its build.gradle (you may put this to the top-level build.gradle if it should be included in all modules):
dependencies {
...
compile group: 'org.achartengine', name: 'achartengine', version: '1.2.0'
}
Now I can use the library in the project, I see the classes in code assist popups and build runs as succeeds.
It seems like the new version (1.2.0) is not available for download anymore in the http://www.achartengine.org/ site. and that's why the gradle/maven method doesn't work (or the snapshot file was removed).
I succeeded using and adding it to my project by downloading the jar file from here:
https://github.com/ddanny/achartengine/files/460139/achartengine-1.2.0.zip

Using gradle to download apk from repository

I'm setting up a CI build system for an android project and am having trouble using gradle to download the artifacts from the build.
In the first step I use gradle to build an .apk and then I push it to a Nexus repository as an artifact. This works successfully and I can see my apk in my repo.
In the second step I am attempting to pull the .apk down from the repository and push it to a device farm. The .apk uploads to the repository just fine, but I can't figure out how to get gradle to download it.
Ideally, in the same build.gradle file that is used to upload the file, I'd have some sort of gradle task that would download the file from the repo and allow me to manipulate it.
So far I've tried:
Specifying the file as a dependency. I add the dependencies closure with a compile(group, name, version, classifier, apk) inside of it. When I run it, it seems that gradle can find the file, however I get this error
apk on project app resolves to an APK archive which is not supported as a compilation dependency.
I believe this is because I'm using the compile command and since I'm downloading an .apk that's not really a thing that you can do to it.
I attempted to use this library
https://github.com/michel-kraemer/gradle-download-task
but am running into issues running it on my machine because of the native .so libraries.
Does anyone know how to use gradle to download an .apk from a nexus repository?
I finally found a way to do what I wanted. In my app level build.gradle I added the following:
configurations {
drivers
}
dependencies {
drivers (group: 'com.my.groupname', name: 'myAppId', version: '0.0.123-SNAPSHOT', classifier: 'apk', ext: 'apk')
}
task copyDrivers(type: Copy) {
from configurations.drivers
into "/builds/dev/mobile-android-sync/android/app/build"
}
Note that when I uploaded my artifacts I used the following code (I think it's important because I specified a classifier):
artifacts {
archives(apk) {
type = "apk"
classifier = 'apk'
}
archives(testApk) {
type = "apk"
classifier = 'testapk'
}
}

AChartEngine And Android Studio

I have to create an application that makes extensive use of charts.
Reading the web I chose achartengine that seems to have everything I need.
I downloaded the jar file, I plugged in the libs folder, I selected "add to library" and I lunch the gradlew clean.
Result in the sources where I do the import of org.achartengine.xxxx I always returned the error that fails to resolve symbols .
Do you have suggestions?
Thank you
Andrea
I am able to use this library in my Android Studio project, this topic explains how to add AChartEngine repo to your project.
What I did:
Added following to project-wide build.gradle (one from the project root):
allprojects {
repositories {
...
maven {
url "https://repository-achartengine.forge.cloudbees.com/snapshot/"
}
}
}
For every module that uses the library, add this to its build.gradle (you may put this to the top-level build.gradle if it should be included in all modules):
dependencies {
...
compile group: 'org.achartengine', name: 'achartengine', version: '1.2.0'
}
Now I can use the library in the project, I see the classes in code assist popups and build runs as succeeds.
It seems like the new version (1.2.0) is not available for download anymore in the http://www.achartengine.org/ site. and that's why the gradle/maven method doesn't work (or the snapshot file was removed).
I succeeded using and adding it to my project by downloading the jar file from here:
https://github.com/ddanny/achartengine/files/460139/achartengine-1.2.0.zip

Categories

Resources