Error "ERROR: build failed with an exception." when starting the application

Viewed 14

Here is the error on normal startup:

FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app:processDebugResources'.

java.nio.file.FileSystemException: C:\Flutter_Projects\hazyaeva\build\app\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar: ������� �� ����� �������� ������ � �����, ��� ��� ���� ���� ����� ������ ���������. 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 17s Exception: Gradle task assembleDebug failed with exit code 1

Here is the error when run with --scan:

Task :app:mergeDebugAssets WARNING: [Processor] Library 'C:\Users\knyzs.gradle\caches\modules-2\files-2.1\com.adcolony\sdk\4.6.5\818fbdf875a91af407c3faa9bfea044f05101168\sdk-4.6.5.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway. Example of androidX reference: 'androidx/annotation/NonNull' Example of support library reference: 'android/support/annotation/NonNull' WARNING: [Processor] Library 'C:\Users\knyzs.gradle\caches\modules-2\files-2.1\co.ogury.module\ogury-ads\4.0.8\94966c91ef3621776c9d9120756adb9dee98043f\ogury-ads-4.0.8.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway. Example of androidX reference: 'androidx/fragment/app/FragmentManager' Example of support library reference: 'android/support/annotation/VisibleForTesting'

Task :app:processDebugMainManifest C:\Flutter_Projects\hazyaeva\android\app\src\debug\AndroidManifest.xml:18:5-81 Warning: uses-permission#android.permission.WRITE_EXTERNAL_STORAGE was tagged at AndroidManifest.xml:18 to replace another declaration but no other declaration present

Task :appodeal_flutter:generateDebugRFile WARNING: [Processor] Library 'C:\Users\knyzs.gradle\caches\modules-2\files-2.1\com.smaato.android.sdk\module-core\21.6.3\b33ec464a5b19d1333070ffce35630f249e2f621\module-core-21.6.3.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway. Example of androidX reference: 'androidx/annotation/NonNull' Example of support library reference: 'android/support/annotation/Nullable' WARNING: [Processor] Library 'C:\Users\knyzs.gradle\caches\modules-2\files-2.1\com.adcolony\sdk\4.6.4\372a410fc325e819baf2817320b5bd369754d2a9\sdk-4.6.4.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway. Example of androidX reference: 'androidx/annotation/NonNull' Example of support library reference: 'android/support/annotation/Nullable' WARNING: [Processor] Library 'C:\Users\knyzs.gradle\caches\modules-2\files-2.1\co.ogury.module\ogury-ads\4.0.7\ecb17275d328f6bf1f62b9d15a462c20ca76877b\ogury-ads-4.0.7.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway. Example of androidX reference: 'androidx/fragment/app/FragmentManager' Example of support library reference: 'android/support/annotation/VisibleForTesting' WARNING: [Processor] Library 'C:\Users\knyzs.gradle\caches\modules-2\files-2.1\com.startapp\inapp-sdk\4.8.11\86a5ddbbdb68c26f2913d7a5d073e653abbe5e1b\inapp-sdk-4.8.11.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway. Example of androidX reference: 'androidx/annotation/Nullable' Example of support library reference: 'android/support/annotation/Nullable'

Task :app:processDebugResources FAILED

FAILURE: Build failed with an exception.

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

java.nio.file.FileSystemException: C:\Flutter_Projects\hazyaeva\build\app\intermediates\compile_and_runtime_not_namespaced_r_class_jar\debug\R.jar: ╨Я╤А╨╛╤Ж╨╡╤Б╤Б ╨╜╨╡ ╨╝╨╛╨╢╨╡╤В ╨┐╨╛╨╗╤Г╤З╨╕╤В╤М ╨┤╨╛╤Б╤В╤Г╨┐ ╨║ ╤Д╨░╨╣╨╗╤Г, ╤В╨░╨║ ╨║╨░╨║ ╤Н╤В╨╛╤В ╤Д╨░╨╣╨╗ ╨╖╨░╨╜╤П╤В ╨┤╤А╤Г╨│╨╕╨╝ ╨┐╤А╨╛╤Ж╨╡╤Б╤Б╨╛╨╝

  • 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.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2m 35s 128 actionable tasks: 127 executed, 1 up-to-date

How to fix it?

1 Answers

@Alexandr

It's failing because you have integrated some package in your application that is not compatible with the gradle version you have been using.

On Android studio, you can check your gradle version by : Open the project (If you are using Flutter, my suggestion would be to Click Open Existing project and then just choose the android directory inside your project's root) > File > Project Structure

You can either make that package compatible with your version of gradle (Probably be editing its MainActivity.kt file)

OR

Use a lower version of gradle (You can change this by going to andoid/build.gradle..Look for a line like this : classpath 'com.android.tools.build:gradle:4.1.0' Here 4.1.0 means gradle v6.7

Try a few values and If you are lucky everything would work just fine! :)

Related