This is my build.gradle file:
buildscript {
repositories {
mavenCentral()
// Configuration for Fabric
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
dependencies {
// 'jar' files in '/libs' folder
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
// Fabric
compile('com.crashlytics.sdk.android:crashlytics:2.+@aar') {
transitive = true;
}
}
repositories {
mavenCentral()
// Configuration for Fabric
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 15
buildToolsVersion 22
// Define current date and time now to have the same all along the build
def currentDate = getCurrentDate()
def currentDateAndTime = getCurrentDateAndTime()
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}
defaultConfig {
versionCode 2.7
versionName name
minSdkVersion 15
targetSdkVersion 22
}
productFlavors {
x86 {
flavorDimension "abi"
ndk {
abiFilter "x86"
}
}
arm {
flavorDimension "abi"
ndk {
abiFilter "armeabi-v7a"
}
}
}
buildTypes {
// Configuration for release candidates
release {
// Proguard configuration
minifyEnabled true
proguardFile 'procfg.pro'
}
lintOptions {
abortOnError false
}
}
After add the dependency to appcompat:
....
dependencies {
// new dependency added
compile 'com.android.support:appcompat-v7:22.0.0'
// 'jar' files in '/libs' folder
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
// Fabric
compile('com.crashlytics.sdk.android:crashlytics:2.+@aar') {
transitive = true;
}
}
....
I'm getting the following errors:
AGPBI: {"kind":"ERROR","text":"Attribute \"textAllCaps\" has already been defined","sourcePath":"<dir>/colors.xml","position":{"startLine":1},"original":""}
AGPBI: {"kind":"ERROR","text":"Attribute \"track\" has already been defined","sourcePath":"<dir>/colors.xml","position":{"startLine":1},"original":""}
AGPBI: {"kind":"ERROR","text":"Attribute \"thumbTextPadding\" has already been defined","sourcePath":"<dir>/colors.xml","position":{"startLine":1},"original":""}
AGPBI: {"kind":"ERROR","text":"Attribute \"switchMinWidth\" has already been defined","sourcePath":"<dir>/colors.xml","position":{"startLine":1},"original":""}
AGPBI: {"kind":"ERROR","text":"Attribute \"switchPadding\" has already been defined","sourcePath":"<dir>/colors.xml","position":{"startLine":1},"original":""}
I have defined none of this values in my color.xml file. I guess the problem could be related to the facebook sdk library.
Let me know if you need more information.
First you can try with the latest v22 of appcompat-v7 22.2.1. If you still have the problem, check the list of dependencies by using gradle with the name of your module:dependencies. If my module is app try in a terminal:
gradle app:dependencies
(or gradlew if you are using the graddle wrapper). You should have something like this:
+--- com.android.support:appcompat-v7:22.2.1
| \--- com.android.support:support-v4:22.2.1
| \--- com.android.support:support-annotations:22.2.1
\--- com.facebook.android:facebook-android-sdk:4.1.0
+--- com.android.support:support-v4:[21,22) -> 22.2.1 (*)
\--- com.parse.bolts:bolts-android:1.2.0
You can see that both appcompat-v7 and facebook-android-sdk own support-v4. To exclude the support-v4 from the facebook sdk, you will have to write:
compile ('com.facebook.android:facebook-android-sdk:4.1.0') {
exclude group:'com.android.support', module: "support-v4"
}
If you run the previous gradle app:dependencies, you will see that now the facebook sdk doesn't have support-v7 in its sub directories.
Hope this will help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.