Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3.0 Dependency issue

Getting Error:

Error:Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.googlecode.mp4parser:isoparser:1.1.22. Open File
Show Details

For Dependency:

compile 'com.googlecode.mp4parser:isoparser:1.1.22'

But for dependency:

compile 'com.googlecode.mp4parser:isoparser:1.1.20'

Gradle Sync Successfully.

Tried using repository:

repositories {
    mavenCentral()
}

Detailed Error:

Unable to resolve dependency for ':app@StagingUnitTest/compileClasspath': Could not resolve com.googlecode.mp4parser:isoparser:1.1.22.

Could not resolve com.googlecode.mp4parser:isoparser:1.1.22. Required by: project :app

Could not resolve com.googlecode.mp4parser:isoparser:1.1.22. Could not get resource 'https://repo1.maven.org/maven2/com/googlecode/mp4parser/isoparser/1.1.22/isoparser-1.1.22.pom'. org.apache.http.ssl.SSLInitializationException: malformed input around byte 0 malformed input around byte 0 malformed input around byte 0

like image 542
Tulsiram Rathod Avatar asked Nov 02 '17 05:11

Tulsiram Rathod


People also ask

Where can I find dependencies in Android Studio?

Go to File > Project structure in Android Studio. Select the app module in the Modules list on the left. Select the Dependencies tab.

Why does Gradle Sync Fail?

In some cases when your Gradle files are deleted or corrupted you will not be able to download new Gradle files in android studio. In this case, we have to delete the Gradle files which are present already and then again sync your project to download our Gradle files again.

Why is Android Studio running so slow?

There may be many plugins in Android Studio that you are not using it. Disabling it will free up some space and reduce complex processes. To do so, Open Preferences >> Plugins and Disable the plugins you are not using.


2 Answers

Just spent 1.5 hours investigating this. My root cause error was

Could not resolve all dependencies for configuration ':classpath'.
Could not resolve io.fabric.tools:gradle:1.+.
 Required by:
     project :
  > Could not resolve io.fabric.tools:gradle:1.+.
     > Failed to list versions for io.fabric.tools:gradle.
        > Unable to load Maven meta-data from https://repo1.maven.org/maven2/io/fabric/tools/gradle/maven-metadata.xml.
           > org.apache.http.ssl.SSLInitializationException: malformed input around byte 12

In the idea.log file, I found this logtrace:

2018-02-15 18:32:32,220 [entQueue-0]  ERROR - net.ssl.ConfirmingTrustManager - Cannot get system trust store 
java.security.KeyStoreException: problem accessing trust storejava.io.UTFDataFormatException: malformed input around byte 12
    at sun.security.ssl.TrustManagerFactoryImpl.engineInit(TrustManagerFactoryImpl.java:74)

    at javax.net.ssl.TrustManagerFactory.init(TrustManagerFactory.java:250)

    at com.intellij.util.net.ssl.ConfirmingTrustManager.getSystemDefault(ConfirmingTrustManager.java:82)

    at com.intellij.util.net.ssl.ConfirmingTrustManager.createForStorage(ConfirmingTrustManager.java:75)

    at com.intellij.util.net.ssl.CertificateManager.<init>(CertificateManager.java:130)

As it turns out the issue was not with Gradle at all, but with Android Studio's internal JRE runtime.

I got the same malformed input around byte 12 error when running keytool against the cacerts file for the android studio JRE

> keytool.exe -list -keystore /c/Program\ Files/Android/Android\ Studio/jre/jre/lib/security/cacerts
keytool error: java.io.UTFDataFormatException: malformed input around byte 12

I replaced the cacerts file in my android studio install with the one from my machine's java install and things are back to normal. My assumption is that the file was corrupted during the update to 3.0, which seems to be the consistent thread in the people who have seen this.

Hope this helps anyone still experiencing this issue.

like image 96
Clayton Sims Avatar answered Sep 17 '22 22:09

Clayton Sims


Just make sure your root level gradle.build file is something like this. You need repo in both project and all project:

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I was able to resolve dependency:

enter image description here

like image 23
Niraj Sanghani Avatar answered Sep 19 '22 22:09

Niraj Sanghani