i had an android project in an old version of Android Studio. I re-installed my windows, and then i installed latest version of Android Studio.
Now, when i Open or Import my project i face this error:
No service of type Factory<LoggingManagerInternal> available in ProjectScopeServices.
Open File
and when i click on Open File link under the error, it directs me to
apply plugin: 'com.github.dcendents.android-maven'
this is my project build.gradle:
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'
version = '0.0.6'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/chunk-templates-3.0.1.jar')
compile 'com.android.support:appcompat-v7:23.1.1'
}
def siteUrl = 'https://github.com/kexanie/MathView'
def gitUrl = 'https://github.com/kexanie/MathView.git'
group = 'io.github.kexanie.library'
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
// Add your description here
name 'A library for displaying math formula in Android apps.'
url siteUrl
// Set your license
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'kexanie'
name 'Brian Lee'
email 'kexanie#gmail.com'
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
dependencies {
}
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 = "MathView"
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = ["Apache-2.0"]
publish = true
}
}
and this is build.gradle app Module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "mathtools.user.com.mathtools"
minSdkVersion 17
targetSdkVersion 23
versionCode 9
versionName "2.4"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile project(':MathView')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.androidplot:androidplot-core:0.9.8'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
}
What do i do?
Change maven gradle plugin version to 1.4.1 in project build.gradle file
> dependencies {
> classpath 'com.android.tools.build:gradle:2.2.2'
> classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1' }
Related
I am creating this library and using Google AdMob in it. After uploading it to JFrog Bintray I recieved an gradle link. I tried to use that to compile but I got an error of Error:Failed to resolve: com.google.android.gms:play-services-ads:11.6.0
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'
group = 'Package-Name'
version = 'Version-number'
bintray {
user = "user-name"
key = "API-Key"
pkg {
repo = 'maven'
name = 'name'
licenses = [required-license]
}
configurations = ['archives']
}
android {
compileSdkVersion 26
buildToolsVersion "27.0.0"
defaultConfig {
minSdkVersion 19
targetSdkVersion 26
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
task generateSourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier 'sources'
}
task generateJavadocs(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath()
.join(File.pathSeparator))
}
task generateJavadocsJar(type: Jar) {
from generateJavadocs.destinationDir
classifier 'javadoc'
}
artifacts {
archives generateJavadocsJar
archives generateSourcesJar
}
}
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:26.+'
compile 'com.google.android.gms:play-services-ads:11.6.0'
testCompile 'junit:junit:4.12'
}
How can I solve this issue?
Please do help.
Thank you in advance.
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'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'
}
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'
}