Flutter-geolocator: It was working fine but suddenly errors started showing and the app cant build

Created on 19 Feb 2019  路  8Comments  路  Source: Baseflow/flutter-geolocator

馃敊 Regression

Old (and correct) behavior

It use to work

Current behavior

now it has errors causing app not to build

Reproduction steps

use geolocator 2.1.1 to reproduce
geolocator: 2.1.1

Error given

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugResources'.

    Android resource linking failed
    Output: C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:37: error: resource android:attr/fontVariationSettings not found.
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:37: error: resource android:attr/ttcIndex not found.
    error: failed linking references.

    Command: C:\Users\xinyo.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\2a2ea7ba6c975c3f1479534f6a6ff44d\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
    C:\Users\xinyo\AppData\Local\Android\sdk\platforms\android-27\android.jar\
    --manifest\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
    -o\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
    -R\
    @C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
    --auto-add-overlay\
    --java\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
    --proguard-main-dex\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\legacy_multidex_aapt_derived_proguard_rules\debug\processDebugResources\manifest_keep.txt\
    --custom-package\
    mycompany.com.foodpluslifevendor\
    -0\
    apk\
    --output-text-symbols\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\symbols\debug\R.txt\
    --no-version-vectors
    Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
    Output: C:\Users\xinyo.gradle\caches\transforms-1\files-1.1\core-1.0.1.aar\cd1c893af6eacddadb6fccbcbd5362d3\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.

    C:\Users\xinyo.gradle\caches\transforms-1\files-1.1\core-1.0.1.aar\cd1c893af6eacddadb6fccbcbd5362d3\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.

    error: failed linking references.
    Command: C:\Users\xinyo.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\2a2ea7ba6c975c3f1479534f6a6ff44d\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
    C:\Users\xinyo\AppData\Local\Android\sdk\platforms\android-27\android.jar\
    --manifest\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
    -o\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
    -R\
    @C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
    --auto-add-overlay\
    --java\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
    --proguard-main-dex\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\legacy_multidex_aapt_derived_proguard_rules\debug\processDebugResources\manifest_keep.txt\
    --custom-package\
    mycompany.com.foodpluslifevendor\
    -0\
    apk\
    --output-text-symbols\
    C:\Users\xinyo\Documents\GitLab\food-plus-life-vendor\food_plus_life_vendor\build\app\intermediates\symbols\debug\R.txt\
    --no-version-vectors
    Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 7s
Finished with error: Gradle task assembleDebug failed with exit code 1

Configuration

Version: 1.x
2.1.1

Platform:

  • [?] :iphone: iOS
  • [x] :robot: Android

Most helpful comment

@momoDragon good to hear it worked for you, I will close this issue now (thank you for providing the link).

For other people the TL;DR version is:

  1. Add the following to your "gradle.properties" file:
android.useAndroidX=true
android.enableJetifier=true
  1. Make sure you set the compileSdkVersion in your "android/app/build.gradle" file to 28:
android {
  compileSdkVersion 28

  ...
}
  1. Make sure you replace all the android. dependencies to their AndroidX counterparts (a full list can be found here: https://developer.android.com/jetpack/androidx/migrate).

All 8 comments

i have the same error, any updates on that?

no idea fam. Hope this gets fixed asap.

@momoDragon, @ariG23498, have you already tried the latest version (3.0.0)?

It looks like you have (partly) updated your project to support AndroidX (compileSdkVersion 28). Version 2.1.1 of the plugin does not support AndroidX which has been resolved in version 3.0.0.

Same problem here.

Is there anyway use back version 2.1.1 or non support AndroidX version?
I using flutter_facebook_login plugin not support AndroidX yet, i can't move project to AndroidX
The other Plugin able to downgrade, but only geolocator got issue.

Please help me~ Thanks

i think migrating to androidX and using the latest plugin worked for me. if u guys have issue migrating u can follow this very straight to the point guide https://medium.com/@swhussain110/how-to-migrate-your-flutter-app-to-androidx-9a78eaaa924b

@althex2015, yes you can. To do so you need to add the following libraries to your pubspec.yaml with the specific version numbers (these are the versions just before the AndroidX migration):

  google_api_availability 1.0.4
  permission_handler: 2.1.2
  geolocator 2.1.1

@momoDragon good to hear it worked for you, I will close this issue now (thank you for providing the link).

For other people the TL;DR version is:

  1. Add the following to your "gradle.properties" file:
android.useAndroidX=true
android.enableJetifier=true
  1. Make sure you set the compileSdkVersion in your "android/app/build.gradle" file to 28:
android {
  compileSdkVersion 28

  ...
}
  1. Make sure you replace all the android. dependencies to their AndroidX counterparts (a full list can be found here: https://developer.android.com/jetpack/androidx/migrate).

@althex2015, yes you can. To do so you need to add the following libraries to your pubspec.yaml with the specific version numbers (these are the versions just before the AndroidX migration):

  google_api_availability 1.0.4
  permission_handler: 2.1.2
  geolocator 2.1.1

It's work, thanks a lot

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Sammius picture Sammius  路  4Comments

deisold picture deisold  路  3Comments

seakmengc picture seakmengc  路  3Comments

shrishti08 picture shrishti08  路  3Comments

prasant10050 picture prasant10050  路  6Comments