speech_recognition icon indicating copy to clipboard operation
speech_recognition copied to clipboard

Execution failed for task ':speech_recognition:verifyReleaseResources'

Open namnh06 opened this issue 5 years ago • 16 comments

Hi guys,

I tried to build an apk with flutter and speech_recognition package but met this bug:

FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':speech_recognition:verifyReleaseResources'. 1 exception was raised by workers: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed /Users/namnh/Projects/revoicer/build/speech_recognition/intermediates/res/merged/release/values/values.xml:233: error: resource android:attr/fontStyle not found. /Users/namnh/Projects/revoicer/build/speech_recognition/intermediates/res/merged/release/values/values.xml:234: error: resource android:attr/font not found. /Users/namnh/Projects/revoicer/build/speech_recognition/intermediates/res/merged/release/values/values.xml:235: error: resource android:attr/fontWeight not found. /Users/namnh/Projects/revoicer/build/speech_recognition/intermediates/res/merged/release/values/values.xml:236: error: resource android:attr/fontVariationSettings not found. /Users/namnh/Projects/revoicer/build/speech_recognition/intermediates/res/merged/release/values/values.xml:237: error: resource android:attr/ttcIndex not found. error: failed linking references.

The app is working fine in debug but got this bug when trying to build the apk.

Could anyone help me out?

namnh06 avatar Jan 05 '20 16:01 namnh06

I had the same problem and fixed it by updating the minSdkVersion and complieSdkVersion in the plugin to 28. If you want to try it out, you can use my fork as source for the plugin:

speech_recognition:
    git:
        url: https://github.com/webeverde/speech_recognition.git
        ref: master

RichiWIP avatar Jan 09 '20 15:01 RichiWIP

Hi. Thanks, @RichiWIP . I had the same issue as mentioned above, tried your answer. Now it working fine. can you tell what happened ?

M0hammedHaris avatar Feb 02 '20 18:02 M0hammedHaris

Hi @RichiWIP @M0hammedHaris

I have same problem try to build an apk with flutter and speech_recognition package.

  • What went wrong:
    Execution failed for task ':speech_recognition:verifyReleaseResources'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource linking failed
/Users/jigneshpatel/.gradle/caches/transforms-2/files-2.1/0a271e99b6771ad4a84318244d532fb7/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontStyle not found.

 /Users/jigneshpatel/.gradle/caches/transforms-2/files-2.1/0a271e99b6771ad4a84318244d532fb7/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/font not found.
                                                                    
 /Users/jigneshpatel/.gradle/caches/transforms-2/files-2.1/0a271e99b6771ad4a84318244d532fb7/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontWeight not found.
                                                                    
 /Users/jigneshpatel/.gradle/caches/transforms-2/files-2.1/0a271e99b6771ad4a84318244d532fb7/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/fontVariationSettings not found.
                                                                    
 /Users/jigneshpatel/.gradle/caches/transforms-2/files-2.1/0a271e99b6771ad4a84318244d532fb7/core-1.0.0/res/values/values.xml:57:5-88:25: AAPT: error: resource android:attr/ttcIndex not found.

My build.gradle

android { compileSdkVersion 28

defaultConfig { minSdkVersion 16 targetSdkVersion 28

help me the solution 😌

Jigneshiosdeveloper avatar Feb 21 '20 06:02 Jigneshiosdeveloper

I have updated the plugin in our fork to now use android x. This makes it compatible with minSDK 16. I have also created a pull request for the changes. In the mean time, you can use my fork as explained above. Be sure to use the newest version. (Check the commit label in your pubspec.lock)

RichiWIP avatar Feb 21 '20 07:02 RichiWIP

@RichiWIP Thanks a lot for your response😀

Jigneshiosdeveloper avatar Feb 21 '20 12:02 Jigneshiosdeveloper

   speech_recognition:
     git:
         url: https://github.com/webeverde/speech_recognition.git
         ref: master

I imported it but it shows me error in the function onRecognitionComplete Here is my code for it :- void onRecognitionComplete() => setState(() => _isListening = false); @RichiWIP So how can I solve it?

OmarYehiaDev avatar Mar 17 '20 12:03 OmarYehiaDev

   speech_recognition:
     git:
         url: https://github.com/webeverde/speech_recognition.git
         ref: master

I imported it but it shows me error in the function onRecognitionComplete Here is my code for it :- void onRecognitionComplete() => setState(() => _isListening = false); @RichiWIP So how can I solve it?

I have no errors in our applications using the plugin or in the example bundled with the plugin. Check that you are using the current version of flutter. I can't help you if you don't post the actual error.

RichiWIP avatar Mar 17 '20 12:03 RichiWIP

@RichiWIP This is the error :- The argument type 'void Function()' can't be assigned to the parameter type 'void Function(String)'.dart(argument_type_not_assignable)

OmarYehiaDev avatar Mar 17 '20 13:03 OmarYehiaDev

@RichiWIP This is the error :- The argument type 'void Function()' can't be assigned to the parameter type 'void Function(String)'.dart(argument_type_not_assignable)

Your version of the plugin is out of date. Sometimes flutter has issues pulling the current version from github. Try commenting out the import, run flutter pub get and the comment it back in and get again.

RichiWIP avatar Mar 17 '20 13:03 RichiWIP

It worked, thank you so much ❤️️❤️️❤️️

OmarYehiaDev avatar Mar 17 '20 13:03 OmarYehiaDev

Hi @RichiWIP and @Jigneshiosdeveloper I don't understand how to fix my error

When i run in debug it works fine however when i build the application I get the below output

What went wrong:

Execution failed for task ':speech_recognition:verifyReleaseResources'.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade Android resource linking failed C:\Users\Devit-BM.gradle\caches\transforms-2\files-2.1\a528b13ac93e64cafa3d0480e2c93207\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontStyle not found.

 C:\Users\Devit-BM\.gradle\caches\transforms-2\files-2.1\a528b13ac93e64cafa3d0480e2c93207\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/font not found.

 C:\Users\Devit-BM\.gradle\caches\transforms-2\files-2.1\a528b13ac93e64cafa3d0480e2c93207\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontWeight not found.

 C:\Users\Devit-BM\.gradle\caches\transforms-2\files-2.1\a528b13ac93e64cafa3d0480e2c93207\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.

 C:\Users\Devit-BM\.gradle\caches\transforms-2\files-2.1\a528b13ac93e64cafa3d0480e2c93207\core-1.1.0\res\values\values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.

Similar to @Jigneshiosdeveloper

android { compileSdkVersion 28

defaultConfig { minSdkVersion 16 targetSdkVersion 28

android.useAndroidX=true

Must work for android 4.1 (SKD 16) as specified in your README

I read through the comments here a few times but am unable to find a solution Help would be much appreciated

DouglasNel avatar May 20 '20 15:05 DouglasNel

I had the same problem and fixed it by updating the minSdkVersion and complieSdkVersion in the plugin to 28. If you want to try it out, you can use my fork as source for the plugin:

speech_recognition:
    git:
        url: https://github.com/webeverde/speech_recognition.git
        ref: master

Yes it's not working for me :(

avani17101 avatar Jul 28 '20 15:07 avani17101

Not working plz help!

Error : The argument type 'void Function()' can't be assigned to the parameter type 'void Function(String)'

 _speechRecognition.setRecognitionCompleteHandler(
        () => setState(() => _isListening = false));

ayush1612 avatar Jul 31 '20 04:07 ayush1612

I had the same problem and fixed it by updating the minSdkVersion and complieSdkVersion in the plugin to 28. If you want to try it out, you can use my fork as source for the plugin:

speech_recognition:
    git:
        url: https://github.com/webeverde/speech_recognition.git
        ref: master

it working thank a lot

lohnsonok avatar Sep 04 '20 23:09 lohnsonok

I had the same problem and fixed it by updating the minSdkVersion and complieSdkVersion in the plugin to 28. If you want to try it out, you can use my fork as source for the plugin:

speech_recognition:
    git:
        url: https://github.com/webeverde/speech_recognition.git
        ref: master

it working thank a lot

I'm able to generated an APK with this fork but I still have a bug. When I speak, onRecognitionComplete() is called twice : first time with the sentence without the last word, and a second time with the complete sentence. I think onRecognitionComplete should be called once.

florianhenonin avatar Oct 22 '20 08:10 florianhenonin

I had the same problem and fixed it by updating the minSdkVersion and complieSdkVersion in the plugin to 28. If you want to try it out, you can use my fork as source for the plugin:

speech_recognition:
    git:
        url: https://github.com/webeverde/speech_recognition.git
        ref: master

this is working 100% fine... thanks alot

waleed-sofstica avatar Sep 22 '21 07:09 waleed-sofstica