我正在尝试将Facebook依赖项添加到我的项目中。
我尝试将以下内容添加到我的pom.xml中:
<dependency>
<groupId>com.facebook.android</groupId>
<artifactId>facebook-android-sdk</artifactId>
<version>4.1.0</version>
<type>aar</type>
</dependency>
突然之间没有找到任何先前接受的依赖项:
当我排除support-v4
库
<dependency>
<groupId>com.facebook.android</groupId>
<artifactId>facebook-android-sdk</artifactId>
<version>4.1.0</version>
<type>aar</type>
<exclusions>
<exclusion>
<artifactId>support-v4</artifactId>
<groupId>com.android.support</groupId>
</exclusion>
</exclusions>
</dependency>
我没有那么多错误,
但它似乎不包括我的依赖:
那里有什么我想念的吗?
这是我的构建:
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.maven.version}</version> <!-- 4.0.0-rc.2 -->
<goals>
<goal>consume-aar</goal>
</goals>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>${platform.version}</platform> <!-- 4.3 -->
</sdk>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
</plugin>
</plugins>
</build>
---编辑----
依赖树似乎很好:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ konnect-android ---
[INFO] com.company:project-android:apk:1.0.0
[INFO] +- com.company:project-shared:jar:1.0.0:compile
[INFO] +- com.google.android:android:jar:4.1.1.4:provided
[INFO] | +- commons-logging:commons-logging:jar:1.1.1:provided
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.0.1:provided
[INFO] | | +- org.apache.httpcomponents:httpcore:jar:4.0.1:provided
[INFO] | | \- commons-codec:commons-codec:jar:1.3:provided
[INFO] | +- org.khronos:opengl-api:jar:gl1.1-android-2.1_r1:provided
[INFO] | +- xerces:xmlParserAPIs:jar:2.6.2:provided
[INFO] | \- xpp3:xpp3:jar:1.1.4c:provided
[INFO] +- com.marvinlabs:android-slideshow-widget:jar:0.5.0:compile
[INFO] +- com.marvinlabs:android-slideshow-widget-picasso- plugin:jar:0.5.0:compile
[INFO] +- com.squareup.okhttp:okhttp:jar:2.3.0:compile
[INFO] | \- com.squareup.okio:okio:jar:1.3.0:compile
[INFO] +- com.squareup.okhttp:okhttp-urlconnection:jar:2.3.0:compile
[INFO] +- com.squareup.picasso:picasso:jar:2.5.2:compile
[INFO] +- com.parse.bolts:bolts-android:jar:1.2.0:compile
[INFO] +- com.facebook.android:facebook-android-sdk:aar:4.1.0:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] \- com.facebook.android:facebook-android-sdk:jar:4.1.0:system
答案 0 :(得分:1)
我最终没有使用maven,直接将facebook源代码作为相关项目包含在接受的答案中:
答案 1 :(得分:0)
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
1. Go to Android Studio | New Project | Minimum SDK
2. Select "API 15: Android 4.0.3" or higher and create your new project.
3. In your project, open
your_app | Gradle Scripts | build.gradle
4. Add the Maven Central Repository to build.gradle before dependencies:
repositories {
mavenCentral()
}
5. Add compile 'com.facebook.android:facebook-android-sdk:[4,5)' to your build.gradle dependencies.
6. Build your project.
7. Import Facebook SDK into your app:
import com.facebook.FacebookSdk;