Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle sync failed: Unable to load class 'org.gradle.internal.logging.LoggingManagerInternal'

I tried to import new library module in my android project (using android studio), which work without any problem, but when I imported it I have this error (when trying to sync gradle):

Gradle sync failed: Unable to load class
'org.gradle.internal.logging.LoggingManagerInternal'.

bulid.gradle for module

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.amazon.mysampleapp"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled = true
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        debuggable true
    }
}

lintOptions {
    abortOnError false
}

sourceCompatibility = 1.7
targetCompatibility = 1.7
}

dependencies {
  compile fileTree(include: ['*.jar'], dir: 'libs')
  compile fileTree(include: ['*.jar'], dir: 'app/libs')
  compile 'com.android.support:appcompat-v7:23.1.0'
  compile 'com.android.support:support-v4:23.1.0'
  compile('com.amazonaws:aws-android-sdk-core:2.2.18')
  compile('com.amazonaws:aws-android-sdk-cognito:2.2.18')
  compile('com.amazonaws:aws-android-sdk-mobileanalytics:2.2.18')
  compile('com.amazonaws:aws-android-sdk-sns:2.2.18')
  compile 'com.google.android.gms:play-services-gcm:7.8.0'
  compile 'com.google.code.gson:gson:2.6.2'
  compile 'com.squareup.retrofit2:retrofit:2.1.0'
  compile 'com.squareup.retrofit2:converter-gson:2.1.0'
  compile 'io.reactivex:rxjava:1.1.6'
  compile 'io.reactivex:rxandroid:1.2.1'
  compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
  compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
}

bulid.gradle for library

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: "com.jfrog.bintray"

def siteUrl = 'https://github.com/Frederikos/RxImagePicker'
def gitUrl = 'https://github.com/Frederikos/RxImagePicker.git'

version = "1.1.9"
group = "com.mlsdev.rximagepicker"

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 = "RxImagePicker"
    websiteUrl = siteUrl
    vcsUrl = gitUrl
    licenses = ["Apache-2.0"]
    publish = true
}
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 8
        versionName "1.1.9"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

install {
    repositories.mavenInstaller {
        pom {
            project {
                packaging 'aar'
                name 'RxImagePicker an easy way to get image from Gallery or Camera with request runtime permission on Android M. Using RxJava'
                url siteUrl
                licenses {
                    license {
                        name 'The Apache Software License, Version 2.0'
                        url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
                    }
                }
                developers {
                    developer {
                        id 'frederikos'
                        name 'frederikos'
                        email '[email protected]'
                    }
                }
                scm {
                    connection gitUrl
                    developerConnection gitUrl
                    url siteUrl

                }
            }
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'io.reactivex:rxandroid:1.0.1'
    compile 'io.reactivex:rxjava:1.0.14'
    compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
//    testCompile 'junit:junit:4.12'
}

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()
}

root level bulid.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
        classpath 'me.tatarka:gradle-retrolambda:3.2.5'

    }
}

apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'


allprojects {
    repositories {
        jcenter()
    }
}

Any Ideas help me.

like image 591
Afnan Khalifa Avatar asked Jul 19 '16 12:07

Afnan Khalifa


3 Answers

For me it worked after altering gradle-wrapper.properties.

I changed distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

to

distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
like image 89
Rahul Avatar answered Nov 16 '22 23:11

Rahul


You need to maintain version of android-maven-gradle-plugin with the appropriate Gradle version.

You will have an idea about the required Gradle version for particular android-maven-gradle-plugin.

https://github.com/dcendents/android-maven-gradle-plugin#note-on-releases

like image 4
Rikin Prajapati Avatar answered Nov 17 '22 00:11

Rikin Prajapati


For me it worked after altering gradle-wrapper.properties.

distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip

like image 1
user3219477 Avatar answered Nov 17 '22 01:11

user3219477