Our android build started failing all on its own without a single line change for 2 days now.
This is the error message:
/Users/shroukkhan/.gradle/caches/transforms-1/files-1.1/ui-5.11.1.aar/baa8b66e2e52a0a50719f014fc3f1c32/res/values/values.xml:40:5-54: AAPT: error: resource android:attr/fontVariationSettings not found.
/Users/shroukkhan/.gradle/caches/transforms-1/files-1.1/ui-5.11.1.aar/baa8b66e2e52a0a50719f014fc3f1c32/res/values/values.xml:40:5-54: AAPT: error: resource android:attr/ttcIndex not found.
As I understand this is related to android support library version mismatch, so i have forced using same library version . However, the problem has persisted. Here is the root level build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url 'https://plugins.gradle.org/m2/' }
maven { url "https://maven.google.com" } // Google's Maven repository
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'hu.supercluster:paperwork-plugin:1.2.7'
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.5.0"
}
}
allprojects {
repositories {
google()
maven { url 'https://jitpack.io' }
maven { url 'https://plugins.gradle.org/m2/' }
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url "https://maven.google.com"
}
flatDir {
dirs 'libs'
}
configurations.all {
resolutionStrategy {
// force certain versions of dependencies (including transitive)
force 'com.squareup.okhttp3:okhttp:3.4.1'
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
details.useVersion "0.38.0"
}
}
}
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
task dependencyReportFile(type: DependencyReportTask) {
outputFile = file('dependencies.txt')
}
ext {
supportLibVersion = "27.1.0"
googlePlayServicesVersion = "15.0.1"
googlePlayServicesAnalyticsVersion = "16.0.4"
envConfigFiles = [
develop: ".env.develop",
production: ".env.production",
staging: ".env.staging",
anycustombuildlowercase: ".env",
]
}
subprojects {
if (project.name.contains('react-native-facebook-login') || project.name.contains('react-native-image-picker') ||
project.name.contains('react-native-permissions') || project.name.contains('react-native-vector-icons') ) {
buildscript {
repositories {
jcenter()
maven { url "https://dl.bintray.com/android/android-tools/" }
}
}
}
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
supportLibVersion = "27.1.0"
googlePlayServicesVersion = "15.0.1" //<-- life save line?
}
}
}
}
subprojects { subproject ->
afterEvaluate{
if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
supportLibVersion = "27.1.0"
googlePlayServicesVersion = "15.0.1"
}
android {
lintOptions {
tasks.lint.enabled = false
}
}
}
}
}
allprojects {
configurations.all {
resolutionStrategy {
eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'com.facebook.react' && details.requested.name == 'react-native') {
details.useVersion "0.38.0" // Your real React Native version here
}
}
}
resolutionStrategy.force 'com.android.support:support-v4:27.1.0'
}
}
And here is the app level build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url 'https://plugins.gradle.org/m2/' }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "io.realm:realm-gradle-plugin:2.3.1"
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.5.0"
}
}
apply plugin: "com.android.application"
apply plugin: 'hu.supercluster.paperwork'
paperwork {
set = [
OKKAMI_APP_VERSION: "2.0",
buildTime : buildTime("yyyy-MM-dd HH:mm:ss", "GMT"),
gitSha : gitSha(),
gitTag : gitTag(),
gitInfo : gitInfo(),
gitBranch : gitBranch()
]
}
import com.android.build.OutputFile
project.ext.envConfigFiles = [
debug : ".env.develop",
release : ".env.production",
staging : ".env.staging",
sixsensesDevelop : ".evn.sixsenses.develop",
sixsensesProduction : ".env.sixsenses.production",
cirqProduction : ".env.cirq.production",
nextDevelop : ".env.next.develolp",
nextProduction : ".env.next.production",
anycustombuildlowercase: ".env.develop",
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
buildToolsVersion = '27.0.3'
lintOptions {
abortOnError false
}
def versionPropsFile = file('../../build')
def versionBuild
def paperworkfile = file('src/main/assets/paperwork.json')
if (versionPropsFile.canRead()) {
FileInputStream fin = new FileInputStream(versionPropsFile);
BufferedReader reader = new BufferedReader(new InputStreamReader(fin));
String ret = reader.readLine();
fin.close();
versionBuild = ret.split("n")[0];
} else {
throw new GradleException("Could not read build file")
}
ext.autoIncrementBuildNumber = {
if (versionPropsFile.canRead()) {
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
versionBuild = versionProps['VERSION_BUILD'].toInteger() + 1
versionProps['VERSION_BUILD'] = versionBuild.toString()
versionProps.store(versionPropsFile.newWriter(), null)
} else {
throw new GradleException("Could not read version.properties!")
}
}
def props = new Properties()
def configFile
def prefix = "OKKAMI"
defaultConfig {
applicationId "com.okkami.android.app"
buildToolsVersion "28.0.3"
compileSdkVersion 28
ndk {
abiFilters "armeabi-v7a", "x86"
}
multiDexEnabled true
manifestPlaceholders = [devUrlCustomScheme: "okkamidevelop", stagingUrlCustomScheme: "okkamistaging", prodUrlCustomScheme: "okkami"]
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
resValue "string", "build_config_package", "com.okkami.android.app"
javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
dexOptions {
javaMaxHeapSize "8g" //specify the heap size for the dex process
}
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
debug { //sign debug apk as well...
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/rxjava.properties'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/maven/pom.properties'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
exclude 'META-INF/gson/FieldAttributes.class'
exclude '.readme'
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
debug {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
flavorDimensions "default"
productFlavors {
// OKKAMI
develop {
applicationId "com.okkami.android.app.dev"
versionCode = versionBuild.toInteger()
versionName = '2.0.' + versionBuild
}
staging {
applicationId "com.okkami.android.app.staging"
versionCode = versionBuild.toInteger()
versionName = '2.1.' + versionBuild
}
production {
applicationId "com.okkami.android.app"
versionCode = versionBuild.toInteger()
versionName = '2.2.' + versionBuild
}
// Six Senses
sixsensesDevelop {
applicationId "com.okkami.android.sixsenses.app.dev"
versionCode = versionBuild.toInteger()
versionName = '2.0.' + versionBuild
}
// sixsensesStaging {
// applicationId "com.okkami.android.sixsenses.app.staging"
// versionCode = versionBuild.toInteger()
// versionName = '2.1.' + versionBuild
// }
//
sixsensesProduction {
applicationId "com.okkami.android.sixsenses.app"
versionCode = versionBuild.toInteger()
versionName = '2.2.' + versionBuild
}
// Cirq
cirqDevelop {
applicationId "com.cirq.android.app.dev"
versionCode = versionBuild.toInteger()
versionName = '2.0.' + versionBuild
}
cirqProduction {
applicationId "com.cirq.android.app"
versionCode = versionBuild.toInteger()
versionName = '2.2.' + versionBuild
}
// Next
nextDevelop {
applicationId "com.okkami.android.next.app.dev"
versionCode = versionBuild.toInteger()
versionName = '2.0.' + versionBuild
}
nextProduction {
applicationId "com.okkami.android.next.app"
versionCode = versionBuild.toInteger()
versionName = '2.2.' + versionBuild
}
}
compileSdkVersion = 27
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
def supportLibraryVersion = "27.1.0"
def firebaseMessagingVersion = "17.3.2"
dependencies {
compile(project(':react-native-camera')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
compile project(':react-native-device-brightness')
implementation project(':react-native-battery')
implementation project(':react-native-fast-image')
implementation project(':react-native-bluetooth-status')
implementation project(':react-native-fetch-blob')
compile 'com.github.nisrulz:easydeviceinfo-base:2.4.0'
implementation(project(':react-native-audio-streaming'))
{
exclude module: 'support-v4'
}
implementation project(':react-native-restart')
implementation project(':react-native-wheel-picker')
implementation project(':react-native-tcp')
implementation project(':react-native-exit-app')
implementation project(':react-native-aws-cognito-js')
implementation project(':react-native-svg')
implementation project(':react-native-fs')
implementation project(':react-native-google-analytics-bridge')
implementation project(':react-native-fbsdk')
implementation project(':react-native-blur')
implementation project(':react-native-geocoder')
implementation project(':react-native-facebook-login')
implementation project(':react-native-vector-icons')
implementation(project(':react-native-maps')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
implementation project(':react-native-i18n')
implementation project(':react-native-config')
implementation project(':okkami-sdk')
implementation project(':react-native-permissions')
implementation project(':okkami-react-sdk')
// Line SDK
compile(name: 'line-sdk-4.0.0', ext: 'aar')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:customtabs:${supportLibraryVersion}"
compile('io.smooch:core:5.11.1') {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
compile('io.smooch:ui:5.11.1') {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
exclude group: 'com.android.support', module: 'support-v4'
}
// compile 'io.smooch:core:5.14.2'
// compile 'io.smooch:ui:5.14.2'
// Libraries imported by Smooch
implementation "com.google.firebase:firebase-core:16.0.3"
implementation "com.google.firebase:firebase-messaging:${firebaseMessagingVersion}"
implementation "com.android.support:exifinterface:${supportLibraryVersion}"
implementation "com.android.support:recyclerview-v7:${supportLibraryVersion}"
implementation "com.android.support:support-media-compat:${supportLibraryVersion}"
implementation "com.google.android.gms:play-services-location:16.0.0"
compileOnly 'org.projectlombok:lombok:1.16.20'
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation "com.google.firebase:firebase-auth:16.0.3"
implementation "com.google.firebase:firebase-firestore:17.1.0"
implementation "com.google.firebase:firebase-analytics:16.0.3"
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
compile 'com.pusher:push-notifications-android:1.0.1'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.facebook.react:react-native:0.20.1'
compile 'com.facebook.android:facebook-android-sdk:4.37.0'
compile 'net.hockeyapp.android:HockeySDK:4.1.3'
compile 'com.android.support:support-core-utils:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:support-v13:27.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'hu.supercluster:paperwork:1.2.7'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.shiraji:butai-java:1.0.2'
compile 'com.android.support:support-v4:27.1.0'
// Lombo
// implementation 'org.projectlombok:lombok:1.16.16'
// HockeyApp
compile 'net.hockeyapp.android:HockeySDK:5.1.1'
// Google Analytics
implementation(project(':react-native-google-analytics-bridge')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
// Badges for Android
compile 'me.leolin:ShortcutBadger:1.1.16@aar'
compile files('libs/AndroidRuntimePermissions.jar')
// Webview for Android
implementation project(':RNWebView')
//compile project(':react-native-mauron85-background-geolocation')
implementation project(':react-native-smart-splashscreen')
implementation project(':openkeysdk-release')
/*guava library used for salto*/
implementation('com.google.guava:guava:18.0') {
exclude module: 'support-v4'
}
//slf4j,bouncycastle and mixpanel used for assa
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'org.slf4j:slf4j-android:1.7.21'
implementation 'org.bouncycastle:bcprov-jdk15on:1.58'
implementation('com.mixpanel.android:mixpanel-android:4.+') {
exclude module: 'support-v4'
}
//OKC
implementation 'com.clj.fastble:FastBleLib:2.3.4'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
compile project(path: ':react-native-linear-gradient')
compile project(path: ':RNMaterialKit')
compile project(path: ':react-native-image-picker')
implementation(project(path: ':react-native-device-info')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
compile project(':react-native-orientation')
compile project(':react-native-full-screen')
implementation(project(':react-native-play-sound')) {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-basement'
exclude group: 'com.google.android.gms', module: 'play-services-tasks'
exclude group: 'com.google.android.gms', module: 'play-services-stats'
}
implementation "com.android.support:support-core-utils:27.1.0"
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
configurations.all {
resolutionStrategy.force "com.google.android.gms:play-services-base:15.0.1"
resolutionStrategy.force "com.google.android.gms:play-services-tasks:15.0.1"
resolutionStrategy.force "com.google.android.gms:play-services-stats:15.0.1"
resolutionStrategy.force "com.google.android.gms:play-services-basement:15.0.1"
resolutionStrategy.force "com.android.support:appcompat-v7:27.1.0"
resolutionStrategy.force 'com.android.support:support-v4:27.1.0'
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
task dependencyReportFile(type: DependencyReportTask) {
outputFile = file('dependencies.txt')
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
I have tracked it down to most likely candidate : io.smooch:ui:5.11.1 ( because the error states : .gradle/caches/transforms-1/files-1.1/ui-5.11.1.aar/baa8b66e2e52a0a50719f014fc3f1c32/res/values/values.xml:40:5-54: AAPT: error: resource android:attr/fontVariationSettings not found. ) . However, no solution proposed online has been working.
Does anyone have any idea whats going on ?
Edit : link to excerpt from dependency tree: https://pastebin.com/raw/YNHWkf5D
3
Answers
The
fontVariationSettings
attribute was added in API Level 28.Set your
compileSdkVersion
to 28 or higher to be able to use libraries that reference this attribute.Change :
TO:
Located in app.gradle file
Clean project and Rebuild
Happy Coding!
Update your fb dependency version-
and you have to add following line to android/gradle.properties: