I’m trying to integrate the Fabric SDK into my Android project (API 15) running on Android Studio.
After included all appropriate entries into both build.gradle files, I end up with a successful build, but my code now doesn’t recognize the Android R class.
It gives me “Cannot resolve symbol ‘R’” in my imports with a big red in letter R:
import com.example.myapp.R;
Here is my project build.gradle file:
apply plugin: 'com.android.application’
apply plugin: ‘io.fabric’
android {
compileSdkVersion 15
buildToolsVersion “23.0.2”
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 15
targetSdkVersion 15
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0’
compile 'com.facebook.android:facebook-android-sdk:4.7.0’
compile(‘com.twitter.sdk.android:twitter:1.10.0@aar’) {
transitive = true;
}
}
And here is my Top level build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url ‘https://maven.fabric.io/public’ }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1’
classpath ‘io.fabric.tools:gradle:1.+’
}
}
allprojects {
repositories {
jcenter()
// To Facebook SDK
mavenCentral()
// To Fabric SDK (Twitter)
maven { url ‘https://maven.fabric.io/public’ }
}
}
The problem solves if I comment the dependency in my project buil.gradle below
compile('com.twitter.sdk.android:twitter:1.10.0@aar') {
transitive = true;
}
or if I upgrade to Android API 23
Unfortunately I’m working with a wearable equipment that only supports API 15 and since Fabric is compatible with it, there should be a solution for this.
Any suggestions?
Thanks in advance.