when i try to build apk in release mode i get this errors:
flutter build apk
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...
Note: C:\Users\mahdi\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\flutter_isolate-1.0.0+10\android\src\main\java\com\rmawatson\flutterisolate\FlutterIsolatePlugin.java uses or overrides a
deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\mahdi\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\flutter_isolate-1.0.0+10\android\src\main\java\com\rmawatson\flutterisolate\FlutterIsolatePlugin.java uses unchecked or u
nsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: G:\Projects\Flutter Examples\audio_service\android\src\main\java\com\ryanheise\audioservice\AudioServicePlugin.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: C:\Users\mahdi\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\audioplayer-0.5.2\android\src\main\java\bz\rxla\audioplayer\AudioplayerPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\mahdi\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\path_provider-1.5.1\android\src\main\java\io\flutter\plugins\pathprovider\PathProviderPlugin.java uses or overrides a dep
recated API.
Note: Recompile with -Xlint:deprecation for details.
Calling mockable JAR artifact transform to create file: C:\Users\mahdi\.gradle\caches\transforms-1\files-1.1\android.jar\67624c73685d76370d8146bd428a66e5\android.jar with input G:\software\sdk
\platforms\android-25\android.jar
Calling mockable JAR artifact transform to create file: C:\Users\mahdi\.gradle\caches\transforms-1\files-1.1\android.jar\d829d7bd065e1149ce76421c52e9e315\android.jar with input G:\software\sdk
\platforms\android-27\android.jar
Removed unused resources: Binary resource data reduced from 54KB to 52KB: Removed 3%
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':audioplayer:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
G:\Projects\Flutter Examples\audio_service\example\build\audioplayer\intermediates\res\merged\release\values\values.xml:233: error: resource android:attr/fontStyle not found.
G:\Projects\Flutter Examples\audio_service\example\build\audioplayer\intermediates\res\merged\release\values\values.xml:234: error: resource android:attr/font not found.
G:\Projects\Flutter Examples\audio_service\example\build\audioplayer\intermediates\res\merged\release\values\values.xml:235: error: resource android:attr/fontWeight not found.
G:\Projects\Flutter Examples\audio_service\example\build\audioplayer\intermediates\res\merged\release\values\values.xml:236: error: resource android:attr/fontVariationSettings not found.
G:\Projects\Flutter Examples\audio_service\example\build\audioplayer\intermediates\res\merged\release\values\values.xml:237: error: resource android:attr/ttcIndex not found.
error: failed linking references.
* 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 2m 56s
Running Gradle task 'assembleRelease'... 177.2s (!)
Gradle task assembleRelease failed with exit code 1
G:\Projects\Flutter Examples\audio_service\example>
me too
This seems to be the problem described here https://github.com/flutter/flutter/issues/45680 .
The two culprits are audioplayer and flutter_isolate. Neither authors are maintaining their plugins anymore although the author of the latter has granted me access to make and publish fixes on his behalf, so at least for that one I can do something about it. For audioplayer, it is only a dependency of the example which is not as serious, but I plan to replace that dependency by just_audio soon. I'll try to get this all working tonight.
I've just published 0.5.6 which fixes the flutter_isolate issue, but audioplayer can't be fixed unless you fork it yourself and upgrade its compileSdkVersion to 28 and also update its gradle wrapper version. Alternatively, you can try my new just_audio plugin although I want to get the iOS side fully working before I switch the example over to it.
I'd be interested to know if the latest release works for you, and if not, you might need to also make the same updates to your app's compileSdkVersion and gradle wrapper version.
The latest release is working.
This issue can be closed.
Glad to hear it works.
Most helpful comment
This seems to be the problem described here https://github.com/flutter/flutter/issues/45680 .
The two culprits are
audioplayerandflutter_isolate. Neither authors are maintaining their plugins anymore although the author of the latter has granted me access to make and publish fixes on his behalf, so at least for that one I can do something about it. Foraudioplayer, it is only a dependency of the example which is not as serious, but I plan to replace that dependency byjust_audiosoon. I'll try to get this all working tonight.