对等未经过身份验证:在 Android Studio 中构建应用程序时出错

2024-06-26

我一直在尝试构建使用 Fabric.io 的 crashlytics 的应用程序。 但构建失败并出现以下错误。

Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources]

Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:classpath'.
   > Could not resolve io.fabric.tools:gradle:1.+.
     Required by:
         TestProject18July2016:app:unspecified
      > 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://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml.
               > Could not GET 'https://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml'.
                  > peer not authenticated

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.367 secs

我的互联网位于代理服务器后面。我已在 gradle.properties 文件中启用 HTTP 和 HTTPS 设置。

## Project-wide Gradle settings.
#
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Mon Jul 18 11:14:57 IST 2016
systemProp.http.proxyPassword=<PASSWORD>
systemProp.https.proxyUser=<USERID>
systemProp.https.proxyPort=<PORT>
systemProp.http.proxyHost=<PROXY_SERVER_ADDRESS>
systemProp.https.proxyPassword=<PASSWORD>
systemProp.https.proxyHost=<PROXY_SERVER_ADDRESS>
systemProp.http.proxyUser=<USERID>
systemProp.http.proxyPort=<PORT>

我的 build.gradle 文件如下:

// 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:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

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

我的 app.gradle 文件如下:

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0"

    defaultConfig {
        applicationId "testfirebase.kishor.testproject18july2016"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
  /*  testCompile 'junit:junit:4.12'*/
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.6.0@aar') {
        transitive = true;
    }
}

目前我正在使用 Android Studio 版本 1.5.1(也尝试过 2.1,但没有运气。) 我在谷歌上搜索了很多,但找不到确切的解决方案。

请帮忙。

Thanks.


经过长时间的努力,我找到了解决方法。

实际上有问题的maven url:https://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml https://maven.fabric.io/public/io/fabric/tools/gradle/maven-metadata.xml

正在重定向到以下网址:https://s3.amazonaws.com/fabric-artifacts/public/io/fabric/tools/gradle/maven-metadata.xml https://s3.amazonaws.com/fabric-artifacts/public/io/fabric/tools/gradle/maven-metadata.xml

不知何故,在 Android studio 中,此重定向失败了。所以在应用程序中build.gradle文件中,我替换了maven url。 从

  maven { url 'https://maven.fabric.io/public' }

to

 maven { url 'http://s3.amazonaws.com/fabric-artifacts/public' }

这解决了我的问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

对等未经过身份验证:在 Android Studio 中构建应用程序时出错 的相关文章

随机推荐