Android Studio 3.0 Dependency issue

本小妞迷上赌 提交于 2019-12-10 17:39:56

问题


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


回答1:


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.




回答2:


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:




回答3:


After lots of research and analysis, re-installing android studio 3.0 resolves issue.




回答4:


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
}



回答5:


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.




回答6:


Make sure that "Offline work" in "Settings" -> "Build, execution, deployment" -> "Gradle" is disabled.



来源:https://stackoverflow.com/questions/47068373/android-studio-3-0-dependency-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!