Gradle 在另一台计算机上打开项目时无法解决 Affectiva Affdex SDK 依赖项的构建失败

Gradle build fail for Affectiva Affdex SDK dependency can not be resolved when opening project on another computer

我正在开发一个使用 Affectiva Affdex SDK 的应用程序,我将其包含在 gradle 文件中。在我工作时在我的电脑上一切正常,直到我试图在家里用我的 MacBook 打开项目(我不认为它与 Windows 和 Apple 有什么关系所以我不想开始无休止的讨论 pros/cons Apple vs. Windows ;) ) 所以问题是构建失败,因为依赖项 compile 'com.affectiva.android:affdexsdk:3.2.0' 无法解析。 我不知道它是否相关,但在工作中我使用代理,在家里我不使用代理。

错误如下:

    Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
   > Could not resolve com.affectiva.android:affdexsdk:3.2.0.
     Required by:
         Emojat:app:unspecified
      > Could not resolve com.affectiva.android:affdexsdk:3.2.0.
         > Could not get resource 'http://maven.affectiva.com/com/affectiva/android/affdexsdk/3.2.0/affdexsdk-3.2.0.pom'.
            > Could not GET 'http://maven.affectiva.com/com/affectiva/android/affdexsdk/3.2.0/affdexsdk-3.2.0.pom'.
               > Connect to 192.168.205.11:8080 [/192.168.205.11] failed: Operation timed out

这是我的应用gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'

    defaultConfig {
        applicationId "com.example.plucinst.emojat"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.affectiva.android:affdexsdk:3.2.0'
    compile 'com.android.support:support-v4:25.3.1'
    compile 'com.android.support:support-v13:25.3.1'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
}

这是项目gradle:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        maven { url 'http://repo1.maven.org/maven2' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

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

allprojects {
    repositories {
        jcenter()
        mavenLocal()
        maven {
            url "http://maven.affectiva.com"
        }
    }
}

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

我不知道是否需要,但这是清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.plucinst.emojat">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

<application
    tools:replace="android:allowBackup,android:label"
    android:allowBackup="true"
    android:icon="@drawable/launcher_icon_alternativ3"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:largeHeap="true"
    android:hardwareAccelerated="true"
    >



    <activity android:name="com.example.plucinst.emojat.MainActivity"><!--com.example.plucinst.emojat.MainActivity-->
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="com.example.plucinst.emojat.ScreenSlidePagerActivity"></activity>
    <activity android:name="com.example.plucinst.emojat.ChatActivity"></activity>
    <activity android:name="com.example.plucinst.emojat.InboxActivity"></activity>
    <activity android:name="com.example.plucinst.emojat.EmojiDetectionActivity"></activity>
    <activity android:name="com.example.plucinst.emojat.EmojiSelectionActivity"></activity>
    <activity android:name="com.example.plucinst.emojat.AndroidDatabaseManager"></activity>
    <activity android:name="com.example.plucinst.emojat.SettingsActivity"></activity>

</application>

非常感谢! :)

正确的工件版本是“3.2”(不是“3.2.0”)。这是 Affectiva 开发人员门户网站上的一个错误,现已更正。