4

SO WHEN I CLICK BUILD PROJECT IT SAYS ZERO ERRORS BUT I STILL GET THIS

 Executing tasks: [clean, :unityLibrary:assembleDebug, :launcher:assembleDebug] in 
    project C:\Users\mehmo\OneDrive\Documents\Game


    > Configure project :launcher
     WARNING: The option 'android.enableR8' is deprecated and should not be used 
    anymore.
    It will be removed in a future version of the Android Gradle plugin, and will no 
   longer allow you to disable R8.

    > Task :clean UP-TO-DATE
    > Task :launcher:clean
    > Task :launcher:preBuild UP-TO-DATE
    > Task :launcher:preDebugBuild UP-TO-DATE
    > Task :launcher:mergeDebugJniLibFolders
    > Task :launcher:generateDebugBuildConfig
    > Task :launcher:generateDebugResValues
    > Task :launcher:mergeDebugNativeLibs
    > Task :launcher:stripDebugDebugSymbols
 > Task :launcher:copyDebugJniLibsProjectAndLocalJars
> Task :launcher:mergeDebugShaders
> Task :launcher:compileDebugShaders
> Task :launcher:generateDebugAssets
> Task :launcher:packageDebugAssets
> Task :launcher:packageDebugRenderscript NO-SOURCE
> Task :launcher:prepareLintJarForPublish UP-TO-DATE
> Task :launcher:processDebugJavaRes NO-SOURCE
> Task :launcher:processDebugManifest
> Task :launcher:mergeDebugJavaResource
> Task :unityLibrary:clean
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:preDebugBuild UP-TO-DATE
> Task :unityLibrary:compileDebugAidl NO-SOURCE
> Task :launcher:compileDebugAidl NO-SOURCE

> Task :unityLibrary:BuildIl2CppTask
Building libil2cpp.so with AndroidToolChain
    Output directory: C:\Users\mehmo\OneDrive\Documents\Game\unityLibrary\src\main\jniLibs\armeabi-v7a
    Cache directory: C:\Users\mehmo\OneDrive\Documents\Game\unityLibrary\build\il2cpp_armeabi-v7a_Release\il2cpp_cache
ObjectFiles: 221 of which compiled: 221
    Time Compile: 12829 milliseconds Lump_libil2cpp_vm.cpp
    Time Compile: 12407 milliseconds Il2CppInvokerTable.cpp
    Time Compile: 11982 milliseconds Unity.TextMeshPro2.cpp
    Time Compile: 11898 milliseconds Generics1.cpp
    Time Compile: 11286 milliseconds Generics.cpp
    Time Compile: 10922 milliseconds Unity.TextMeshPro3.cpp
    Time Compile: 10625 milliseconds mscorlib4.cpp
    Time Compile: 9856 milliseconds Unity.TextMeshPro4.cpp
    Time Compile: 9713 milliseconds Lump_libil2cpp_icalls.cpp
    Time Compile: 8830 milliseconds Generics10.cpp
Total compilation time: 56052 milliseconds.
Total link time: 2164 milliseconds.
Cleaned up 0 object files.
Building libil2cpp.so with AndroidToolChain
    Output directory: C:\Users\mehmo\OneDrive\Documents\Game\unityLibrary\src\main\jniLibs\arm64-v8a
    Cache directory: C:\Users\mehmo\OneDrive\Documents\Game\unityLibrary\build\il2cpp_arm64-v8a_Release\il2cpp_cache
ObjectFiles: 221 of which compiled: 221
    Time Compile: 12777 milliseconds Lump_libil2cpp_vm.cpp
    Time Compile: 11706 milliseconds Il2CppInvokerTable.cpp
    Time Compile: 11465 milliseconds Generics1.cpp
    Time Compile: 11200 milliseconds Unity.TextMeshPro2.cpp
    Time Compile: 10710 milliseconds Generics.cpp
    Time Compile: 10155 milliseconds Unity.TextMeshPro3.cpp
    Time Compile: 9667 milliseconds Lump_libil2cpp_icalls.cpp
    Time Compile: 9315 milliseconds mscorlib4.cpp
    Time Compile: 9026 milliseconds Unity.TextMeshPro4.cpp
    Time Compile: 8415 milliseconds Generics3.cpp
Total compilation time: 54646 milliseconds.
Total link time: 3373 milliseconds.
Cleaned up 0 object files.

> Task :unityLibrary:mergeDebugJniLibFolders
> Task :unityLibrary:compileDebugRenderscript NO-SOURCE
> Task :unityLibrary:generateDebugBuildConfig
> Task :unityLibrary:generateDebugResValues
> Task :unityLibrary:generateDebugResources
> Task :unityLibrary:packageDebugResources
> Task :unityLibrary:parseDebugLocalResources
> Task :unityLibrary:mergeDebugShaders
> Task :unityLibrary:compileDebugShaders
> Task :unityLibrary:generateDebugAssets
> Task :unityLibrary:packageDebugAssets
> Task :unityLibrary:packageDebugRenderscript NO-SOURCE
> Task :launcher:compileDebugRenderscript NO-SOURCE
> Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
> Task :launcher:generateDebugResources
> Task :unityLibrary:processDebugJavaRes NO-SOURCE
> Task :unityLibrary:processDebugManifest
> Task :unityLibrary:javaPreCompileDebug
> Task :launcher:packageDebugResources
> Task :launcher:parseDebugLocalResources
> Task :unityLibrary:mergeDebugNativeLibs
> Task :unityLibrary:stripDebugDebugSymbols
> Task :unityLibrary:copyDebugJniLibsProjectAndLocalJars
> Task :unityLibrary:mergeDebugJavaResource
> Task :unityLibrary:generateDebugRFile

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':unityLibrary:compileDebugJavaWithJavac'.

Failed to query the value of task ':unityLibrary:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'. Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:\Users\mehmo\OneDrive\Documents\Game\unityLibrary\build\generated\ap_generated_sources\debug\out))) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@35383760) before task ':unityLibrary:compileDebugJavaWithJavac' has completed is not supported

  • 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/7.0.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 59s 34 actionable tasks: 31 executed, 3 up-to-date

IN DEBUG I GET THIS:

2021-05-19T16:15:40.480+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2021-05-19T16:15:40.480+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2021-05-19T16:15:40.480+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2021-05-19T16:15:40.480+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2021-05-19T16:15:40.480+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':unityLibrary:compileDebugJavaWithJavac'.
2021-05-19T16:15:40.481+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Failed to query the value of task ':unityLibrary:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
2021-05-19T16:15:40.481+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]    > Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:\Users\mehmo\OneDrive\Documents\Game\unityLibrary\build\generated\ap_generated_sources\debug\out))) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer@4ece53fe) before task ':unityLibrary:compileDebugJavaWithJavac' has completed is not supported
2021-05-19T16:15:40.481+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2021-05-19T16:15:40.481+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
2021-05-19T16:15:40.481+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.  Run with --scan to get full insights.
2021-05-19T16:15:40.481+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
2021-05-19T16:15:40.481+0100 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org

2021-05-19T16:15:40.481+0100 [WARN] [org.gradle.internal.featurelifecycle.LoggingDeprecatedFeatureHandler] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/7.0.1/userguide/command_line_interface.html#sec:command_line_warnings

2021-05-19T16:15:40.481+0100 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 
2021-05-19T16:15:40.481+0100 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 2m 1s
Omar Mehmood
  • 41
  • 1
  • 1
  • 4

2 Answers2

7

I encountered this issue as well and decided to scrap my entire project and do a clean setup. Turns out that Gradle 7.x is incompatible with Android development. If you downgrade your Gradle to 6.9 everything works as expected.

This would explain also why "Build Project" works, but through Gradle it doesn't, it's a different wrapper instance.

danthonywalker
  • 368
  • 3
  • 14
4

Changing the Gradle version of distributionUrl in gradle-wrapper.properties file works for me.

I'm now using Unity 2021.3.5f1 version. From here (https://docs.unity3d.com/Manual/android-gradle-overview.html), I know that I should use Gradle version 6.1.1.

To change the Gradle version, open gradle-wrapper.properties file, update distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip with the Gradle version found above. Then, sync and rebuild the project. Build success!

Hope it would help you!

bunnyxt
  • 41
  • 3