我正在开发一个使用 Affectiva Affdex SDK 并包含在 gradle 文件中的应用程序。在我尝试在家里的 MacBook 上打开项目之前,一切都在我的电脑上运行良好(我认为这与 Windows 与 Apple 无关,所以我不想开始无休止地讨论优缺点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
这是我的应用程序:
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'
}
这是项目等级:
// 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>
提前谢谢了!:)