185

Warning:The android.dexOptions.incremental property is deprecated and it has no effect on the build process. /home/midhilaj/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/be3106efb0df111fe5a3f7b356dd070b/res/values/values.xml Error:(246, 5) error: resource android:attr/fontVariationSettings not found. /project/bkup/7_march_2018/hyshoper/milla/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml Error:(246, 5) error: resource android:attr/ttcIndex not found. Error:(269) resource android:attr/ttcIndex not found. Error:(269) resource android:attr/fontVariationSettings not found. Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:failed linking references. Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:Execution failed for task ':milla:processDebugAndroidTestResources'.

Failed to execute aapt Information:9 errors Information:BUILD FAILED in 2s Information:1 warning Information:See complete output in console

How to solve this issue? my dependencies

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })


    compile 'de.hdodenhof:circleimageview:2.2.0'



    compile('com.alibaba.android:ultraviewpager:1.0.6.1@aar') {
        transitive = true
    }
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile 'com.synnapps:carouselview:0.1.4'
    compile 'com.sun.mail:android-mail:1.5.5'
    compile 'com.sun.mail:android-activation:1.5.5'
    implementation 'com.muddzdev:styleabletoast:2.0.2'
    compile 'javax.annotation:javax.annotation-api:1.2'




    compile 'me.grantland:autofittextview:0.2.+'
    // base library
     //slider
    compile 'com.ss.bannerslider:bannerslider:1.8.0'
    //noinspection GradleCompatible
    compile 'jp.wasabeef:recyclerview-animators:2.2.7'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.github.satyan:sugar:1.4'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:percent:26.1.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.github.satyan:sugar:1.4'
    compile 'jp.wasabeef:recyclerview-animators:2.2.6'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
    compile 'com.afollestad.material-dialogs:core:0.9.4.2'
    compile 'com.google.android.gms:play-services:9.8.0'
    compile 'com.google.android.gms:play-services-auth:9.8.0'
    compile 'com.google.android.gms:play-services-location:9.8.0'
    compile 'com.google.firebase:firebase-core:9.8.0'
    compile 'com.google.firebase:firebase-auth:9.8.0'
    compile 'com.google.firebase:firebase-database:9.8.0'
    compile 'com.google.firebase:firebase-config:9.8.0'
    compile 'com.google.firebase:firebase-crash:9.8.0'
    compile 'com.google.firebase:firebase-invites:9.8.0'
    compile 'com.google.firebase:firebase-storage:9.8.0'
    compile 'cn.pedant.sweetalert:library:1.3'
    compile 'at.blogc:expandabletextview:1.0.3'
    compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.+'
    compile 'com.android.support:appcompat-v7:26.1.0'

    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    implementation 'com.android.support:design:26.1.0'

}
Midhilaj
  • 4,905
  • 9
  • 45
  • 88
  • 1
    i solved my problem here: https://stackoverflow.com/questions/49162538/running-cordova-build-android-unable-to-find-attribute-androidfontvariation – Gilson Mar 10 '18 at 22:16
  • Hey I got the same Issue same like you, "App not installed" while sending .apk file to others.Can you please help me on this. – Naveen Mar 13 '18 at 11:50

24 Answers24

323

try to change the compileSdkVersion to:

compileSdkVersion 28

fontVariationSettings added in api level 28. Api doc here

zyc zyc
  • 3,805
  • 1
  • 14
  • 14
  • 3
    I had to change to version 28 when I added latest Kotlin Extensions library to the project and I was getting this error. Thanks! – Micer Aug 06 '18 at 20:14
  • 1
    This fixed the following issue for me: "resource android:attr/fontVariationSettings not found." – AdamHurwitz Aug 08 '18 at 00:38
  • 1
    @Micer sorry, I'm not sure what happened in your project, may be you need clean and rebuild. or resolve the dependencies in the project. – zyc zyc Aug 08 '18 at 03:31
  • 2
    @zyczyc What I meant is that I was using 27 and upgrade to 28 solved all issues. I tried clean and rebuild before with no luck. – Micer Aug 08 '18 at 07:20
  • 1
    @anunixercoder I had the same problem. Sdk 28 is no option, so I searched :app:depencies for conflicts and locked the versions zu to api 27 compatible dependencies like FilipFloryan below (build-extras.gradle ) mentioned. – Hank Lapidez Jun 27 '19 at 13:31
  • I forget to increment my `26` `compileSdkVersion` in my old project. This issue came up, and after update it to `28` all good now. Thanks @zy – mochadwi Nov 13 '19 at 08:00
  • I forget to increment my `26` `compileSdkVersion` in my old project. This issue came up, and after update it to `28` all good now. Thanks @zy – mochadwi Nov 13 '19 at 08:00
  • I searched for all occurrences of `compileSdkVersion 27` and changed to `compileSdkVersion 28` ... everything worked perfectly – Jalal El-Shaer Dec 18 '19 at 10:48
  • Thanks! This works fine for Flutter by editing the `build.gradle` file inside the `android` directory :-) – Daniel Jul 30 '20 at 19:41
  • I have updated compileSdkVersion to 28 then used flutter clean, flutter clean pub cache clear, flutter build apk commands to generate release build apk but this solution did not work for me and showing same error. Please suggest. Thank you. – Kamlesh Sep 05 '20 at 04:57
  • I already have compileSdkVersion 29 but I am still getting this error – Slick Slime Sep 05 '20 at 11:52
  • owww no.... if i upgrade to compileSdkVersion 28 means i'm downloading new files.... sigh.... which version that applicable for compileSdkVersion 26 anyway? – gumuruh Jan 02 '21 at 10:49
  • owww no.... if i upgrade to compileSdkVersion 28 means i'm downloading new files.... sigh.... which version that applicable for compileSdkVersion 26 anyway? – gumuruh Jan 02 '21 at 10:50
55

This is caused by an incompatibility with the android support library that changed to version 28. I solved the problem by forcing the build to use a lower support library. //like build gradle

configurations.all {
        resolutionStrategy {
                force 'com.android.support:support-v4:27.1.0'
    }
} 

My project built successfully immediately after I changed this. Hope this might help you too. I lost a day of development because of this!.

akhil
  • 1,649
  • 3
  • 19
  • 31
23

For those that must keep compileSdkVersion 27 and are unable to upgrade to androidx yet, you must not upgrade to (or over) the versions of dependencies in the following links. These links are where the breaking change was introduced. You must find an earlier version that doesn't use androidx.

https://firebase.google.com/support/release-notes/android#update_-_june_17_2019

https://developers.google.com/android/guides/releases#june_17_2019

For instance, the following are compatible with compileSdkVersion 27:

dependencies {
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
}

The following will break with compileSdkVersion 27 and are only compatible with compileSdkVersion 28:

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-messaging:19.0.0'
}
Regular User
  • 682
  • 7
  • 16
  • 3
    Thank you for giving a solution to those who need to temporally keep version 27 (the accepted answer is too simplistic) – Don Jun 25 '19 at 08:29
  • Thank you! I had compileSdkVersion set to 28 but I wasn't using androidx libraries and changing firebase to lower version helped. – michalbrz Jul 21 '19 at 18:35
  • I have updated compileSdkVersion to 28 then used flutter clean, flutter clean pub cache clear, flutter build apk commands to generate release build apk but this solution did not work for me and showing same error. Please suggest. Thank you. – Kamlesh Sep 05 '20 at 04:58
10

If you are updating to v28

change the compileSdkVersion to compileSdkVersion 28

Pablo Cegarra
  • 20,955
  • 12
  • 92
  • 110
  • @victorsosa app/build.gradle – Pablo Cegarra Jun 20 '19 at 06:01
  • I put there but getting a error; can you give a example, please? – victor sosa Jun 21 '19 at 12:34
  • I have updated compileSdkVersion to 28 then used flutter clean, flutter clean pub cache clear, flutter build apk commands to generate release build apk but this solution did not work for me and showing same error. Please suggest. Thank you. – Kamlesh Sep 05 '20 at 04:58
10

I solve this problem with the line below:

cordova plugin add cordova-android-support-gradle-release --save

After that the compile was succesful.

John Prado
  • 804
  • 8
  • 19
6

For native Android apps (not Cordova) solution for me is:

Was:

implementation 'com.android.support:support-v13:+'

Now:

implementation 'com.android.support:support-v13:27.1.1'
Eugene Voronoy
  • 1,384
  • 1
  • 14
  • 18
6

@All the issue is because of the latest major breaking changes in the google play service and firebase June 17, 2019 release.

If you are on Ionic or Cordova project. Please go through all the plugins where it has dependency google play service and firebase service with + mark

Example:

In my firebase cordova integration I had com.google.firebase:firebase-core:+ com.google.firebase:firebase-messaging:+ So the plus always downloading the latest release which was causing error. Change + with version number as per the March 15, 2019 release https://developers.google.com/android/guides/releases

Make sure to replace + symbols with actual version in build.gradle file of cordova library

bheema
  • 323
  • 1
  • 5
  • 9
5

Another fix for Ionic 3 devs is to create build-extras.gradle inside platforms/android and put following

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.0'
    }
}

Note that build-extras.gradle is not the same as build.gradle

Filip Floryan
  • 145
  • 2
  • 6
4

after upgrading to Android 3.4.2 and FTC SDK5.2. I got these errors when building APK:

Android resource linking failed C:\Users\idsid\FTC\SkyStone\TeamCode\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1205: error: resource android:attr/fontVariationSettings not found. C:\Users\idsid\FTC\SkyStone\TeamCode\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1206: error: resource android:attr/ttcIndex not found. error: failed linking references.

What I did is to add following section to project build gradle and problem is fixed.

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 28
                buildToolsVersion '29.0.2'
            }
        }
    }
}

Good luck.

4

I encountered this error in a flutter project and all I had to do update my compileSdkVersion to 28.

STEPS:

  1. In your app level build.gradle file, search for compileSdkVersion
  2. Check the current version
  3. If less than 28, update it to 28

As zyc zyc stated above, the property fontVariationSettings was added in API level 28.

You can also read more about it here

3

Usually it's because of sdk versions and/or dependencies.

For Cordova developers, put your dependencies settings in "project.properties" file under CORDOVA_PROJECT_ROOT/platforms/android/ folder, like this:

target=android-26
android.library.reference.1=CordovaLib
android.library.reference.2=app
cordova.system.library.1=com.android.support:support-v4:26.1.0
cordova.gradle.include.2=cordova-plugin-googlemaps/app-tbxml-android.gradle
cordova.system.library.3=com.android.support:support-core-utils:26.1.0
cordova.system.library.4=com.google.android.gms:play-services-maps:15.0.0
cordova.system.library.5=com.google.android.gms:play-services-location:15.0.0

So if you use CLI "cordova build", it will overwrite the dependencies section:

dependencies {
    implementation fileTree(dir: 'libs', include: '*.jar')
    // SUB-PROJECT DEPENDENCIES START 
   /* section being overwritten by cordova, referencing project.properties */
...
    // SUB-PROJECT DEPENDENCIES END
}

If you are using proper libraries and its versions in project.properties, you should be fine.

Joanne
  • 1,226
  • 13
  • 15
2

This was a pain in the ass for me! Especially after updating to Android Studio 3.2.1 and Gradle 4.6 (for Gradle developers).

I think there is more than one factor that could cause such a build exception. For me, I had the following lines of code in my gradle.properties file (using SDK version 27):

android.useAndroidX=true
android.enableJetifier=true

AndroidX is the alternative to Android's default Support Library and should be used when compiling and targeting SDK version 28 (API 28). Before the updating Android Studio and Gradle, I had added the lines above in preparation to eventually fully migrate to AndroidX to use SDK version 28 and the build ran successfully. It was only after the update that I received an error similar to that above:

error: resource android:attr/fontVariationSettings not found

Hope this helps.

marvatron
  • 311
  • 3
  • 3
2

If you have stumbled upon this problem due to getting this error recently out of nowhere in react native- this is due to the latest BREAKING CHANGE in Google Play service and Firebase. Check this thread first -

https://github.com/facebook/react-native/issues/25293

And solution would mostly be like this -

https://github.com/facebook/react-native/issues/25293#issuecomment-503045776

Anirudha Paul
  • 195
  • 10
2

I had the same error, but don't know why it appeared. After searching solution I migrated project to AndroidX (Refactor -> Migrate to AndroidX...) and then manually changed whole classes imports etc. and in layout files too (RecyclerViews, ConstraintLayouts, Toolbars etc.). I changed also compileSdkVersion and targetSdkVersion to 28 version and whole project/application works fine.

slepster
  • 41
  • 5
2

If anybody has this error using phonegap or cordova with the cordova-plugin-fcm-ng or cordova-plugin-fcm plugin, the solution that worked for me is creating the extra config file for gradle "build-extras.gradle" in the \platforms\android\app folder, and putting the following lines in it

configurations.all {
 resolutionStrategy {
  force 'com.google.firebase:firebase-messaging:18.0.0'
  force 'com.google.firebase:firebase-core:16.0.8'
 }
}

I found this solution reading this page https://github.com/facebook/react-native/issues/25371, in particular comment of shreyakupadhyay on 30/07/19 and consulting https://developers.google.com/android/guides/releases#may_07_2019 about last libraries version.

2

error: resource android:attr/fontVariationSettings not found

I got this error when i added ButterKnife library but upgrading compileSdkVersion to 28 and targetSdk to 28 solved my issue.

Raveesh G S
  • 524
  • 6
  • 7
2

I had this problem suddenly happening after trying to pull a dependency depending on sdk 28 (firebase crashlytics), but then decided to revert back the changes.

I tried automatic refactor Migrate to Androidx (which do half the job), added android.useAndroidX=true in gradle.properties at some points, and make the project work again.

But it was a lot of changes before a delivery. There was no way to have the project compile again with SDK 27. I git clean -fd, removed $HOME/.gradle, and kept seeing androidx in ./gradlew :app:dependencies

I ended up removing ~/.AndroidStudio3.5/ too (I'm on 3.5.3). This makes the project compile again, and I discovered the dark mode...

FredG
  • 712
  • 7
  • 10
1

For Ionic 3 devs. I had to update the platforms/android/project.properties file ONLY on:

cordova.system.library.2

to be v4:28.0.0+ otherwise the build kept failing.

After doing so, my project.properties file contents are shown below:

target=android-26
android.library.reference.1=CordovaLib
cordova.system.library.1=com.android.support:support-v4:24.1.1+
cordova.system.library.2=com.android.support:support-v4:28.0.0+
cordova.system.library.3=com.android.support:support-v4:+
cordova.system.library.4=com.android.support:support-v4:25.+
cordova.system.library.5=com.android.support:appcompat-v7:25.+
cordova.gradle.include.1=cordova-plugin-googlemaps/starter-tbxml-android.gradle
cordova.system.library.6=com.google.android.gms:play-services-maps:15.0.1
cordova.system.library.7=com.google.android.gms:play-services-location:15.0.1
cordova.system.library.8=com.android.support:support-core-utils:26.1.0
cordova.system.library.9=com.squareup.okhttp3:okhttp-urlconnection:3.10.0
cordova.gradle.include.2=cordova-android-support-gradle-release/pasma-cordova-android-support-gradle-release.gradle

I hope this helps someone. Was a real problem for me.

Tony Ross
  • 23
  • 1
  • 7
1

For me : My external library was using this attributes attr/fontVariationSettings and attr/ttcIndex so I downgrade my library version and sync project . everything fine

So now :

 compileSdkVersion 27 
 implementation 'com.android.support:appcompat-v7:27.1.1'

and for future readers that library was google's easypermission.

implementation 'pub.devrel:easypermissions:2.0.0'

This lib is using sdkversion 28, I have to downgrade to 1.3.0

Tejas Pandya
  • 3,987
  • 1
  • 26
  • 51
  • 1
    Hi there, how to you check if this lib is using sdkversion 28? – Thomas Kim Jul 02 '19 at 10:21
  • 1
    @ThomasKim . after implementing this library i got this error . I search and verified that `attributes attr/fontVariationSettings and attr/ttcIndex` belongs to `28` only . So i downgrade this lib and its working . So i figure out that was the cause – Tejas Pandya Jul 02 '19 at 12:12
  • 1
    I see, I have a question, why didnt you choose to upgrade to 28? upgrading it will solve too right(?) (btw, I am facing this problem for almost 3 days and not knowing which plugin was wrong ) – Thomas Kim Jul 02 '19 at 13:14
  • 2
    @ThomasKim because at the time of writing that answer . there are some bugs in 28 which is causing issues in design view rendering. so 27 is better for me – Tejas Pandya Jul 03 '19 at 04:50
1

I have soled the problem by changing target android version to 28 in project.properties (target=android-28) and installed cordova-plugin-androidx and cordova-plugin-androidx-adapter.

Manoj Alwis
  • 1,337
  • 11
  • 24
1

I just got this AndroidX error again after I fixed it a year ago. I am using Flutter.

I was able to make releases using Flutter 1.7.8+hotfix.4, then recently I updated Flutter to version 1.17.4 and then I could not compile a release build any more. Debug builds worked just fine.

TLDR: This time it was a package using another package that was not updated proper for AndroidX
Make sure to update your packages! :)

Error message: Important part

[+1099 ms] > Task :package_info:verifyReleaseResources FAILED 
[  +10 ms] FAILURE: Build failed with an exception. 
[  +10 ms] * What went wrong: 
[  +29 ms] Execution failed for task ':package_info:verifyReleaseResources'. 
[   +3 ms] java.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed 
[   +7 ms]  ...\build\package_info\intermediates\res\merged\release\values\values.xml:171:error: resource android:attr/fontVariationSettings not found. 
[   +2 ms] ...\build\package_info\intermediates\res\merged\release\values\values.xml:172:error: resource android:attr/ttcIndex not found.     
[   +1 ms] error: failed linking references.

Error message: Distraction

       FAILURE: Build failed with an exception.

       * What went wrong:
       A problem occurred configuring root project 'barcode_scan'.
       > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

"fontVariationSettings not found". is an AndroidX error, which requires you to use compileSdkVersion 28, but I already had that, so I suspect something was implemented between my two Flutter versions to be more restrictive.

So I had to go hunting and updated packages and found that. "package_info: ^0.3.2" needed to be "package_info: ^0.4.0" to make it work. To make it "more" future proof write it like this:

package_info: '>=0.4.0 <2.0.0'

After updating packages my code base compiles for release again. Hope it helps.

Bo Kristensen
  • 1,460
  • 11
  • 8
0

I removed all the unused plugins in the pubspec.yaml and in the External Libraries to solve the problem.

hatted
  • 1,535
  • 1
  • 15
  • 26
0

My case was really different. I had set android:text=" ??? " property of my TetxtView in my layout file, when I changed it to android:text=" ? " it worked. I have no idea why this works, maybe it helps someone. It took me hours to find the issue.

yrazlik
  • 10,411
  • 33
  • 99
  • 165
0

I had the same issue and I installed this cordova plugin and problem solved.

cordova plugin add cordova-android-support-gradle-release --save