I'm trying to publish an AAR with javadoc file to my maven repo through artifactory gradle puglin.
The aar file is doing uploaded with success, but i the javadoc don't. Which script can i use to upload my javadocs?.
This is my build.gradle code
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
def packageName = 'br.com.lexsis.libtest'
def libraryVersion = '0.0.1-SNAPSHOT'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}
publishing {
publications {
aar(MavenPublication) {
groupId packageName
version = libraryVersion
artifactId project.getName()
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("_releaseCompile").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
// The Artifactory repository key to publish to
repoKey = libraryVersion.endsWith('SNAPSHOT') ? 'libs-snapshot-local' : 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
}
defaults {
// Tell the Artifactory Plugin which artifacts should be published to Artifactory.
publications('aar')
publishArtifacts = true
// Properties to be attached to the published artifacts.
properties = ['qa.level': 'basic', 'dev.team': 'core']
// Publish generated POM files to Artifactory (true by default)
publishPom = true
}
}
}
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.srcDirs
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
Your publication only includes the aar file:
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
Add another artifact - the output of the androidJavadocsJar task:
artifact androidJavadocsJar
Repeat for sources jar, if you want.
This works for me.
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
def packageName = 'br.com.lexsis.libtest'
def libraryVersion = '0.0.1-SNAPSHOT'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}
publishing {
publications {
aar(MavenPublication) {
groupId packageName
version = libraryVersion
artifactId project.getName()
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact androidJavadocsJar
pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("_releaseCompile").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
// The Artifactory repository key to publish to
repoKey = libraryVersion.endsWith('SNAPSHOT') ? 'libs-snapshot-local' : 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
}
defaults {
// Tell the Artifactory Plugin which artifacts should be published to Artifactory.
publications('aar')
publishArtifacts = true
// Properties to be attached to the published artifacts.
properties = ['qa.level': 'basic', 'dev.team': 'core']
// Publish generated POM files to Artifactory (true by default)
publishPom = true
}
}
}
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.srcDirs
}
artifacts {
archives androidSourcesJar
archives androidJavadocsJar
}
Related
I followed the step by step guide found here:
https://www.codeproject.com/Articles/840623/Android-Character-Recognition
At step 2 when I added tess-two as module dependency to app and synced gradle, it failed with the following error:
Error:Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :libraries:tess-two.
I have tried many combinations of settings.gradle and searched for hours, any help will be much appreciated, thanks!
build.gradle file under tess-two
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
consumerProguardFiles 'proguard-rules.pro'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
jni.srcDirs = []
jniLibs.srcDirs = ['libs']
}
}
// Call external ndk-build(.cmd) script to build the native code
task ndkBuild(type: Exec) {
def ndkDirProperty = properties.getProperty('ndk.dir')
def ndkDirPrefix = ndkDirProperty != null ? ndkDirProperty + '/' : ''
def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
commandLine "${ndkDirPrefix}ndk-build${ndkBuildExt}", '-C', file('.').absolutePath,
'-j', Runtime.runtime.availableProcessors()
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
// Cleanup task to remove previously generated binaries
task ndkClean(type: Exec) {
def ndkDirProperty = properties.getProperty('ndk.dir')
def ndkDirPrefix = ndkDirProperty != null ? ndkDirProperty + '/' : ''
def ndkBuildExt = Os.isFamily(Os.FAMILY_WINDOWS) ? ".cmd" : ""
commandLine "${ndkDirPrefix}ndk-build${ndkBuildExt}", '-C', file('.').absolutePath, 'clean'
}
tasks.withType(Delete) {
cleanTask -> cleanTask.dependsOn ndkClean
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':libraries:tess-two')
}
// Settings for uploading module AAR to Bintray for library distribution
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError = false
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://d.android.com/reference","${android.sdkDirectory}/docs/reference"
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
install {
repositories.mavenInstaller {
pom.project {
name = 'tess-two'
packaging = 'aar'
groupId = 'com.rmtheis'
artifactId = 'tess-two'
developers {
developer {
id = 'rmtheis'
name = 'Robert Theis'
email = 'robert.m.theis#gmail.com'
}
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
url 'https://github.com/rmtheis/tess-two'
}
}
}
}
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = 'maven'
name = 'tess-two'
userOrg = user
publish = true
}
}
settings.gradle
include ':app'
include ':libraries:tess-two'
include 'app:libraries:tess-two'
project(':libraries:tess-two').projectDir = new File('libraries/tess-two')
Hi so I'm following the github site of Gradle Bintray Plugin https://github.com/bintray/gradle-bintray-plugin#readme tutorial however I don't quite understand the publications part. Can anyone help me with this? I'am currently working on bintray version 1.7.3.
Update:
I was able to upload successfully in bintray. However my current problem now is when downloading it in other projects. I have errors when syncing gradle :
-Could not find android-dbpatcher.jar(sirqo:android-dbpatcher:0.0.1).
-Error: Searched in the following locations:
http://sirqo.bintray.com/Android-DBPatcher/sirqo/android-dbpatcher/0.0.1/android-dbpatcher-0.0.1.jar
Update2:
For reference this is my gradle.build in my module
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
group = 'xxxx'
version = '0.0.1'
install {
repositories.mavenInstaller {
pom.project {
name 'android-dbpatcher'
description 'A library for updating SQLite database in android.'
url 'https://sirqo.bintray.com/Android-DBPatcher'
inceptionYear '2016'
packaging 'aar'
groupId 'xxxx'
artifactId 'android-dbpatcher'
version '0.0.1'
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 'xxxx'
name 'xxxxx'
email 'xxxxxx#gmail.com'
}
}
}
}
}
Properties bintrayProperties = new Properties()
bintrayProperties.load(project.rootProject.file('bintray.properties').newDa taInputStream())
bintray {
user = bintrayProperties.getProperty('user')
key = bintrayProperties.get('key')
configurations = ['archives']
pkg {
repo = 'Android-DBPatcher'
name = 'android-dbpatcher'
userOrg = 'xxxx'
vcsUrl = 'https://github.com/sirqo/android-dbpatcher'
publish = true
version {
name = '0.0.1'
desc = 'Android SQLite Database Patcher'
released = new Date()
vcsTag = 'v0.0.1'
}
}
}
So I figured it out. For reference I'll share my code.
For my Project gradle.build
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id "com.jfrog.bintray" version "1.7.3"
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And for my module gradle.build
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.volley:volley:1.0.0'
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath +=project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
group = 'xxxx' //bintray org/group name
version = '0.0.1' //version
install {
repositories.mavenInstaller {
pom.project {
name 'xxxxx' //package name
description 'A library for updating SQLite database in android.'
url 'xxxxx'
inceptionYear '2016'
packaging 'aar'
groupId 'xxxx' //group/org id
artifactId 'xxxx' //your android module name
version '0.0.1'
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 'xxxxx' //developer username
name 'xxxxxx' //developer name
email 'xxxxxx#gmail.com' //developer email
}
}
scm {
connection 'xxxxxx' // YOUR GIT REPO
developerConnection 'xxxxxx' // YOUR GIT REPO
url 'xxxxxxx' // YOUR SITE
}
}
}
}
Properties bintrayProperties = new Properties()
bintrayProperties.load(project.rootProject.file('bintray.properties').newDataInputStream())
bintray {
user = bintrayProperties.getProperty('user')
key = bintrayProperties.get('key')
configurations = ['archives']
pkg {
repo = 'xxxxxx' //Bintray repository
name = 'xxxxxx' //Bintray Package name
userOrg = 'xxxxx'
licenses = ['Apache-2.0']
vcsUrl = 'xxxxxxxx'
publish = true
version {
name = '0.0.1' //version
desc = 'xxxxxx' //Description
released = new Date()
vcsTag = 'v0.0.1'
}
}
}
After this open the android terminal below in your android studio and enter this command
./gradlew install
if there is some errors you can append the command with --debug and re-enter the command to trace the error
//if nothing else fail issue this command
./gradlew bintrayUpload
*again if there is an error you can use the command and append with --debug to trace it.
after all these you will recieve an email or something and then you can proceed to downloading your library in other projects. Happy coding!
i frist import Mudole and add these code to my project build.gradel
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.github.lzyzsd:circleprogress:1.1.0#aar'
}
and
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
but mudole build.gradle have errore
Error:(2, 0) Cause:
org/gradle/api/publication/maven/internal/DefaultMavenFactory Open File
and this mudele gradle:
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
version = "1.2.0"
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 10
targetSdkVersion 21
versionCode 5
versionName version
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
def siteUrl = 'https://github.com/lzyzsd/CircleProgress'
def gitUrl = 'https://github.com/lzyzsd/CircleProgress.git'
group = "com.github.lzyzsd.circleprogress"
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here
name 'Circle Progress, Donut Progress, Arc Progress'
url siteUrl
// Set your license
licenses {
license {
name 'MIT'
url 'http://opensource.org/licenses/MIT'
}
}
developers {
developer {
id 'lzyzsd'
name 'Bruce Lee'
email 'bruceinpeking#gmail.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = "maven"
name = "CircleProgress"
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["MIT"]
publish = true
}
}
apply plugin: 'maven'
i download mudole from https://github.com/lzyzsd/CircleProgress
just change version gradle to 1.0
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
You need to update gradle plugin and version.
Update gradle plugin by Replacing
apply plugin: 'android-maven'
with
apply plugin: 'com.github.dcendents.android-maven'
and update gradle version by adding this :
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
and sync project.
I get following error while running gradlew install.
Failed to capture snapshot of input files for task 'javadoc' during up-to-date check. See stacktrace for details.
Could not normalize path for file 'C:\android\sdk\platforms\android-23\android.jar;C:\android\sdk\platforms\android-23\optional\org.apache.http.legacy.jar'
The project's build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The library module's build.gradle:
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'
ext {
bintrayRepo = 'maven'
bintrayName = 'befrest'
publishedGroupId = 'com.oddrun.libraries'
libraryName = 'Befrest'
artifact = 'befrest'
libraryDescription = 'Simple Push Notification Library For Android'
siteUrl = 'https://github.com/hojjat-imani/PushNotif'
gitUrl = 'https://github.com/hojjat-imani/PushNotif.git'
libraryVersion = '0.0.1'
developerId = 'hojjat-imani'
developerName = 'Hojjat Imani'
developerEmail = 'imani.hojjat95#gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 10
targetSdkVersion 23
versionCode 0
versionName "0.0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
}
version = libraryVersion
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
publish = true
publicDownloadNumbers = true
version {
desc = libraryDescription
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = properties.getProperty("bintray.gpg.password")
//Optional. The passphrase for GPG signing'
}
}
}
}
group = publishedGroupId // Maven Group ID for the artifact
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
groupId publishedGroupId
artifactId artifact
// Add your description here
name libraryName
description libraryDescription
url siteUrl
// Set your license
licenses {
license {
name licenseName
url licenseUrl
}
}
developers {
developer {
id developerId
name developerName
email developerEmail
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
You can add org.apache.http.legacy.jar in your libs folder.
You can find this jar in Android/Sdk/platforms/android-23/optional
I also added this line to my app.gradle file
compile files('libs/org.apache.http.legacy.jar')
But if you're using more libraries, you can use this way
compile fileTree(dir: 'libs', include: ['*.jar'])
This resolved all my errors that were caused because google removed support of Apache HTTP client. Do not changed compileSdkVersion 23 to 22, I think this solution is better.
There seems to be a problem with apache http in android 23.
Just changing compileSdkVersion 23 to 22 and removing useLibrary 'org.apache.http.legacy' solved the problem.
In my android application i had imported Module from GitHub https://github.com/IsseiAoki/SimpleCropView#download .But after sync my gradle i get error :
Error:(21, 0) Plugin with id 'com.github.dcendents.android-maven' not found.
in added modules built.gradle file which is as follows.
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
versionCode 9
versionName "1.0.8"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'
group = 'com.isseiaoki'
version = '1.0.8'
def siteUrl = 'https://github.com/IsseiAoki/SimpleCropView'
def gitUrl = 'https://github.com/IsseiAoki/SimpleCropView.git'
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives'] //When uploading configuration files
pkg {
repo = 'maven'
name = 'SimpleCropView'
desc = 'A simple image cropping library for Android.'
websiteUrl = siteUrl
issueTrackerUrl = 'https://github.com/IsseiAoki/SimpleCropView/issues'
vcsUrl = gitUrl
licenses = ['MIT']
labels = ['android']
publicDownloadNumbers = true
}
}
install {
repositories.mavenInstaller {
pom {
project {
packaging 'aar'
name 'SimpleCropView'
url siteUrl
licenses {
license {
name 'The MIT License (MIT)'
url 'http://opensource.org/licenses/MIT'
}
}
developers {
developer {
id 'isseiaoki'
name 'Issei Aoki'
email 'i.greenwood.dev#gmail.com'
}
}
scm {
connection 'https://github.com/IsseiAoki/SimpleCropView.git'
developerConnection 'https://github.com/IsseiAoki/SimpleCropView.git'
url siteUrl
}
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
task findConventions << {
println project.getConvention()
}
This package is already available on jcenter repo, so instead of include by source code, add compile package name in dependencies block of your app's build.gradle
dependencies {
compile 'com.isseiaoki:simplecropview:1.0.8'
}
UPDATE:
Your dependencies should look like
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:design:22.2.0'
compile 'com.isseiaoki:simplecropview:1.0.8'
}