Search code examples
androiddependenciesandroid-gradle-pluginbuild.gradleaffdex-sdk

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


I am developing an application which uses the Affectiva Affdex SDK and which I am including in the gradle file. Everything worked fine on my computer at work until I tried to open the project at home on my MacBook (I don't think it has sth to do with Windows vs. Apple so I don't wanna start an endless discussion about pros/cons Apple vs. Windows ;) ) So the thing is that the build fails because the dependency compile 'com.affectiva.android:affdexsdk:3.2.0' cannot be resolved. I dunno if it's relevant but at work I use a proxy, at home I do not use one.

Here's the error:

    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

This is my app 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'
}

This is the project 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
}

I dunno if necessary but here's the manifest:

<?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>

Many thanks in advance! :)


Solution

  • The correct artifact version is "3.2" (not "3.2.0"). This was a mistake on the Affectiva Developer Portal, which is now corrected.