I have problem with gradle in Android Studio 0.5.2.
It's shown below:
Could not find com.android.support:support-v4:19.0.0.
Required by:
org.codepond:wizardroid:1.2.0
Please install the Android Support Repository from the Android SDK Manager.
I Also Installed Android Support Repository.
My build.gradle looks like this:
apply plugin: 'android-library'
apply plugin: 'android-maven'
apply plugin: 'signing'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode project.ext.versionCode
versionName version
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.0'
}
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
boolean hasCredentials = hasProperty('sonatypeUsername') && hasProperty('sonatypeUsername')
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
configuration = configurations.archives
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
if (hasCredentials) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
if (hasCredentials) {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}
pom.project {
name 'WizarDroid'
description 'Lightweight Android library for creating step by step wizards'
url 'http://wizardroid.codepond.org'
scm {
url 'http://www.github.com/nimrodda/wizardroid'
connection 'scm:git://github.com/Nimrodda/WizarDroid.git'
developerConnection 'scm:git://github.com/Nimrodda/WizarDroid.git'
}
licenses {
license {
name 'The MIT License (MIT)'
url 'https://raw.github.com/Nimrodda/WizarDroid/master/license'
distribution 'repo'
}
}
developers {
developer {
id 'nimrodda'
name 'Nimrod Dayan'
email 'feedback#codepond.org'
}
}
organization {
name 'CodePond.org'
url 'http://www.codepond.org'
}
issueManagement {
system 'GitHub Issues'
url 'https://github.com/nimrodda/wizardroid/issues'
}
parent {
groupId 'org.sonatype.oss'
artifactId 'oss-parent'
version 7
}
}
}
}
}
You should change build.gradle to
dependencies {
compile 'com.android.support:support-v4:19.1.+'
}
Related
I have cloned a project from github and getting the following error while building up the project: "The "android" command is no longer included in the SDK. Any references to it (e.g. by third-party plugins) should be removed."
The gradle file is:
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'
// Scheme for version codes: ####$$$ , using:
// ## - the first two digits for the API Level,
// ## - the second and third digits for the minimum and maximum screen size
// (1 - 4 indicating each of the four sizes) or to denote the texture formats
// $$$ - the last three digits for the app version.
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
versionCode 800410
versionName "4.1"
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
assets.srcDirs = ['src/main/assets']
}
}
}
allprojects {
// show deprecation warnings for all projects
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation"
options.compilerArgs << "-Xlint:unchecked"
}
}
dependencies {
compile 'com.jakewharton.timber:timber:2.7.1'
}
version = "4.1.0"
//version = '2.9.0-SNAPSHOT'
group = "be.shouldit"
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
if (isReleaseVersion) {
println 'Building RELEASE'
ext.sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
} else {
println 'Building SNAPSHOT'
ext.sonatypeRepo = "https://oss.sonatype.org/content/repositories/snapshots/"
}
ext.sonatypeUsername = hasProperty("sonatypeUsername") ? sonatypeUsername : ""
ext.sonatypePassword = hasProperty("sonatypePassword") ? sonatypePassword : ""
configurations {
archives {
extendsFrom configurations.default
}
}
repositories {
mavenCentral()
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
task publishLocal(type: Upload) {
configuration = configurations.archives
repositories.mavenDeployer {
repository(url: "file://$buildDir/repo")
}
}
uploadArchives {
configuration = configurations.archives
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: project.ext.sonatypeRepo) {
authentication(userName: project.ext.sonatypeUsername,
password: project.ext.sonatypePassword)
}
pom.project {
name 'Android Proxy Library'
packaging 'aar'
description 'Proxy utility library for Android applications'
url 'https://github.com/shouldit/android-proxy'
scm {
url 'scm:git#github.com:shouldit/android-proxy.git'
connection 'scm:git#github.com:shouldit/android-proxy.git'
developerConnection 'scm:git#github.com:shouldit/android-proxy.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'lechuckcaptain'
name 'abc'
email 'abc#gmail.com'
}
}
}
}
}
Links that I have already tried:
https://stackoverflow.com/questions/42720255/errorthe-android-command-is-no-longer-included-in-the-sdk-any-references-to?noredirect=1&lq=1
https://github.com/stetro/project-tango-poc/issues/9
etc.
I know that this question has already been asked but the solutions are not working for me as in the above gradle file there is not "sdk or apt" plugin used so please help to solve this issue.
Finally I have solved this issue, there was one more package in the project having build.gradle file, from there i removed plugin of sdk manager and error gone.
In my pom file I have one artifact like below:
<artifactItem>
<groupId>com.xyz</groupId>
<artifactId>xyz.abc</artifactId>
<version>1.0</version>
<classifier>pqr</classifier>
<type>js</type>
<overWrite>true</overWrite>
<outputDirectory>/opt/test</outputDirectory>
<destFileName>test.js</destFileName>
</artifactItem>
How to implement this in my build.gradle. I am using gradle 2.6.
Sorry, I cannot post original code so put some unrealistic values. Please reply
WIth gradle you can use the maven plugin.
You can find the full doc for the 2.6 here.
I don't know if you can set all attributes, but you can use a script like this:
apply plugin: 'maven'
apply plugin: 'signing'
afterEvaluate { project ->
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
pom.groupId = GROUP
pom.artifactId = POM_ARTIFACT_ID
pom.version = VERSION_NAME
repository(url: "...") {
authentication(userName: "user", password: "pass")
}
snapshotRepository(url: "...") {
authentication(userName: "user", password: "pass")
}
pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}
developers {
developer {
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
}
}
}
}
}
}
signing {
required { true }
sign configurations.archives
}
artifacts {
archives xxxx
}
}
i created a gradle task
task test <<{
copy {
from --dir---
into --dir--
rename { String fileName ->
fileName.replace("xyz.abc-$1.0-pqr","user-prefs")
}
}
}
It worked for me.
I'm trying to create a maven library using Android Studio and bintray but I can't get it working. When I try to upload the lib using gradle bintrayUpload I allways get the following error:
Could not upload to 'https://api.bintray.com/content/company/maven/company-simplename-lib/simplename/company-simplename-lib/lib/0.0.1/lib-0.0.1.pom': HTTP/1.1 400 Bad Request [message:Unable to upload files: Maven group, artifact or version defined in the pom file do not match the file path 'company-simplename-lib/lib/0.0.1/lib-0.0.1.pom']
This happens when I try to follow the example bintray has in their github repo.
I have changed my library build.gradle (not the root) to the following:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
plugins {
id "com.jfrog.bintray" version "1.4"
}
version = '0.0.1'
allprojects {
repositories {
jcenter()
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName '0.0.1'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
}
install {
repositories.mavenInstaller {
pom.project {
name 'EasyGoogle'
description 'A wrapper library for basic functions of Google Play Services APIs'
url 'https://github.com/googlesamples/easygoogle'
inceptionYear '2015'
packaging 'aar'
groupId 'pub.devrel'
artifactId 'android-maven-example'
version '0.1'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
connection 'https://github.com/googlesamples/easygoogle.git'
url 'https://github.com/googlesamples/easygoogle'
}
developers {
developer {
name 'Google'
}
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
configurations = ['archives']
pkg {
repo = 'maven'
name = 'company-simplename-lib'
userOrg = user
licenses = ['Apache-2.0']
vcsUrl = 'http://example.com/android/company-simplename-lib.git'
version {
name = 'simplename'
desc = 'test build'
vcsTag = '0.0.1'
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}
Is someone able to see what I'm doing wrong? Becasue I can't and I can't find any good documentation about this either.
Please go through below blog , it clearly explain everything.
http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
If you still face issue of uploading pom file then make sure
libraryName , artifact and module name should be same.
I got it working by removing the install part from the gradle file so it looks like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
plugins {
id "com.jfrog.bintray" version "1.4"
}
version = '0.0.4'
allprojects {
repositories {
jcenter()
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName '0.0.4'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
configurations = ['archives']
pkg {
repo = 'maven'
name = 'company-simplename-lib'
userOrg = user
licenses = ['Apache-2.0']
vcsUrl = 'http://gitlab.company-servic.es/android/company-simplename-lib.git'
version {
name = 'simplename'
desc = 'test build'
vcsTag = '0.0.4'
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}
Hi am getting the following error while adding facebook sdk to my project
Tried the following post for configuring the gradle script for facebook sdk
link
Error:(111) A problem occurred evaluating project ':facebook'.
> Cannot call getBootClasspath() before setTargetInfo() is called.
This is my facebook module gradle script
apply plugin: 'com.android.library'
repositories {
mavenCentral()
}
project.group = 'com.facebook.android'
dependencies {
compile 'com.android.support:support-v4:[21,22)'
compile 'com.parse.bolts:bolts-android:1.1.4'
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
minSdkVersion 18
targetSdkVersion 22
}
lintOptions {
abortOnError false
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
}
apply plugin: 'maven'
apply plugin: 'signing'
def isSnapshot = version.endsWith('-SNAPSHOT')
def ossrhUsername = hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
def ossrhPassword = hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
task setVersion {
// The version will be derived from source
project.version = null
def sdkVersionFile = file('src/com/facebook/FacebookSdkVersion.java')
sdkVersionFile.eachLine{
def matcher = (it =~ /(?:.*BUILD = \")(.*)(?:\".*)/)
if (matcher.matches()) {
project.version = matcher[0][2]
return
}
}
if (project.version.is('unspecified')) {
throw new GradleScriptException('Version could not be found.', null)
}
}
uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name 'Facebook-Android-SDK'
artifactId = 'facebook-android-sdk'
packaging 'aar'
description 'Facebook Android SDK'
url 'https://github.com/facebook/facebook-android-sdk'
scm {
connection 'scm:git#github.com:facebook/facebook-android-sdk.git'
developerConnection 'scm:git#github.com:facebook/facebook-android-sdk.git'
url 'https://github.com/facebook/facebook-android-sdk'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'https://github.com/facebook/facebook-android-sdk/blob/master/LICENSE.txt'
distribution 'repo'
}
}
developers {
developer {
id 'facebook'
name 'Facebook'
}
}
}
}
}
uploadArchives.dependsOn(setVersion)
signing {
required { !isSnapshot && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
task androidJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
classifier = 'javadoc'
from androidJavadocs.destinationDir
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
afterEvaluate {
androidJavadocs.classpath += project.android.libraryVariants.toList().first().javaCompile.classpath
}
Please help....
Your issue: Cannot call getBootClasspath() before setTargetInfo() is called., I believe has been solved here:
http://tools.android.com/tech-docs/new-build-system
Android Build tools 1.1.0 created this problem and they fixed it in 1.1.1:
1.1.1 (2015/02/24)
Only variants that package a Wear app will now trigger building them.
Dependency related issues now fail at build time rather than at debug time.
This is to allow running diagnostic tasks (such as 'dependencies') to help resolve the conflict.
Calling android.getBootClasspath() is now possible again.
Please upgrade to: classpath 'com.android.tools.build:gradle:1.2.3', for example:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
I'm trying to FTP the signed APK after a Gradle build. I've already added the new build config that will sign the APK, but I'm stuck trying to figure out how to invoke an FTP task.
I found an official looking sample at section 59.6, however it complains that it cannot resolve dependency org.apache.ant:ant-commons-net:1.8.4. So apparently I'm missing something obvious here, like where to put a given jar file or reference it, although I thought maven would handle this sort of thing?
For reference, here is the linked sample which fails with a message about the dependency:
configurations {
ftpAntTask
}
dependencies {
ftpAntTask("org.apache.ant:ant-commons-net:1.8.4") {
module("commons-net:commons-net:1.4.1") {
dependencies "oro:oro:2.0.8:jar"
}
}
}
task ftp << {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
ftp(server: "ftp.apache.org", userid: "anonymous", password: "me#myorg.com") {
fileset(dir: "htdocs/manual")
}
}
}
This fails with the message:
> Could not find org.apache.ant:ant-commons-net:1.8.4.
Here is my complete gradle.build file, with some sensitive information removed:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 17
}
signingConfigs {
signed {
storeFile file("(removed)")
storePassword "(removed)"
keyAlias "(removed)"
keyPassword "(removed)"
}
}
buildTypes {
signed {
debuggable false
jniDebugBuild false
signingConfig signingConfigs.signed
}
}
}
configurations {
ftpAntTask
}
dependencies {
ftpAntTask("org.apache.ant:ant-commons-net:1.8.4") {
module("commons-net:commons-net:1.4.1") {
dependencies "oro:oro:2.0.8:jar"
}
}
}
task ftp << {
ant {
taskdef(name: 'ftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
ftp(server: "(removed)", userid: "(removed)", password: "(removed)", remoteDir: "(removed)") {
fileset(dir: "(removed)") {
include(name: "(removed)")
}
}
}
}
You havn't declared a repository that can be used to resolve the declared artifacts. Try adding the following snippet to your build.gradle file:
repositories{
mavenCentral()
}
cheers,
René
You can also use the native ant get task which supports FTP, works with no outside dependencies:
ant {
get(src: "ftp://<hostname>/remote/path/to/file.jar", dest: "/local/path/to/file", username: 'anonymous', password: 'anonymous')
}