简体   繁体   中英

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

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:

在此输入图像描述

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.

经过大量的研究和分析,重新安装android studio 3.0解决了问题。

As I check isoparser artifact also available in jcenter repo.

so add jcenter in your repository link.

repositories {
    mavenCentral()
    jcenter()
    google()        // <- required, when artifact is in google repo
}

Add also these repos:

jcenter()
google()

if you are behind proxy there may be problems with https connection so you may force it to use http, by adding:

maven { url "http://jcenter.bintray.com/" }
maven { url "http://repo.maven.apache.org/maven2" }
maven { url "http://maven.google.com" }

UPDATE: Yesterday I faced the similar package error, tried everything but finally the only solution was deleting entire .gradle folder in user profile (not in project), or in user home directory in Linux. After that a long sync will start but finally everything will be ok. It seems that this problem caused by gradle cache corrupted during AS update to the new release. It happen to me in both Windows and Fedora systems. And HTTP error message just set all people to seek the solutioin in the wrong way.

确保禁用“设置” - >“构建,执行,部署” - >“Gradle”中的“脱机工作”。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM