Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

FileNotFoundException while building apk

Discussion in 'Android' started by young-xyz, Dec 13, 2018.

  1. young-xyz

    young-xyz

    Joined:
    Feb 23, 2015
    Posts:
    43
    I have an error while building android apk.


    FileNotFoundException: Temp\gradleOut\build\outputs\apk\release\gradleOut-release.apk does not exist
    System.IO.File.Move (System.String sourceFileName, System.String destFileName) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:318)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:272)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


    It shows that "Temp\gradleOut\build\outputs\apk\release\gradleOut-release.apk" does not exist, but I can find the file in "Temp\gradleOut\build\outputs\apk\gradleOut-release.apk".

    How can I correct this?

    EDIT: I'm Unity 2017.4.17f, too.
     
    Last edited: Dec 13, 2018
  2. ahxpolar

    ahxpolar

    Joined:
    Jul 5, 2013
    Posts:
    2
    I have same issue.

    EDIT: Unity 2017.4.17f
     
  3. ahxpolar

    ahxpolar

    Joined:
    Jul 5, 2013
    Posts:
    2
    I may solved.
    change gradle version in Plugin/Android/mainTemplate.gradle '3.2.0'

    buildscript {
    repositories {
    google()
    jcenter()
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:3.2.0'
    }
    }
     
    fdsagizi2 and young-xyz like this.
  4. fullcorder

    fullcorder

    Joined:
    Mar 9, 2015
    Posts:
    2
    Unity2017.4.18 have same issue.
    I solved it. Thank you.
     
  5. fdsagizi2

    fdsagizi2

    Joined:
    Nov 4, 2013
    Posts:
    70
    its help me too! My problem was:

    FileNotFoundException: Temp/gradleOut/build/outputs/bundle/release/gradleOut.aab does not exist
     
  6. LaiYizhou

    LaiYizhou

    Joined:
    Mar 24, 2017
    Posts:
    1
    I have same issue.

    Unity2017.4.26f1

    FileNotFoundException: Temp\gradleOut\build\outputs\apk\release\gradleOut-release.apk does not exist
    System.IO.File.Move (System.String sourceFileName, System.String destFileName) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:318)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:272)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    But:
    1. It shows that "Temp\gradleOut\build\outputs\apk\release\gradleOut-release.apk" does not exist, and I actually DO NOT find the file

    2. the gradle version in Plugin/Android/mainTemplate.gradle has been '3.2.0', NEED NOT TO CHANGE

    and the issue is still here.

    so, what should I do?

    thx for help.

    20190517165553.jpg
     
    gameproj likes this.
  7. hottabych

    hottabych

    Joined:
    Apr 18, 2015
    Posts:
    107
    The same problem:
    FileNotFoundException: Temp\gradleOut\build\outputs\apk\release\gradleOut-armeabi-v7a-release.apk does not exist

    Unity 2019.1.3f1

    mainTemplate.gradle:
    Code (CSharp):
    1. // GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
    2. buildscript {
    3.     repositories {
    4.         google()
    5.         jcenter()
    6.     }
    7.  
    8.     dependencies {
    9.         classpath 'com.android.tools.build:gradle:3.2.0'
    10.     }
    11. }
    12.  
    13. allprojects {
    14.    repositories {
    15.     google()
    16.     jcenter()
    17.       flatDir {
    18.         dirs 'libs'
    19.       }
    20.    }
    21. }
    22.  
    23. apply plugin: 'com.android.application'
    24.  
    25. dependencies {
    26.     compile fileTree(dir: 'libs', include: ['*.jar'])
    27. **DEPS**}
    28.  
    29. android {
    30.     compileSdkVersion **APIVERSION**
    31.     buildToolsVersion '**BUILDTOOLS**'
    32.  
    33.     defaultConfig {
    34.         multiDexEnabled true
    35.         minSdkVersion    **MINSDKVERSION**
    36.         targetSdkVersion **TARGETSDKVERSION**
    37.         applicationId '**APPLICATIONID**'
    38.         ndk {
    39.             abiFilters **ABIFILTERS**
    40.         }
    41.         versionCode    **VERSIONCODE**
    42.         versionName    '**VERSIONNAME**'
    43.     }
    44.  
    45.     lintOptions {
    46.         checkReleaseBuilds false    //dirty hack
    47.         abortOnError false
    48.     }
    49.  
    50.     aaptOptions {
    51.         noCompress '.unity3d', '.ress', '.resource', '.obb'**STREAMING_ASSETS**
    52.     }
    53.  
    54. **SIGN**
    55.     buildTypes {
    56.           debug {
    57.              minifyEnabled **MINIFY_DEBUG**
    58.              useProguard **PROGUARD_DEBUG**
    59.              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
    60.               jniDebuggable true
    61.           }
    62.           release {
    63.              minifyEnabled **MINIFY_RELEASE**
    64.              useProguard **PROGUARD_RELEASE**
    65.               proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
    66.               **SIGNCONFIG**
    67.           }
    68.     }
    69. **PACKAGING_OPTIONS**
    70. }
    71.  
    72.  
    73. **SOURCE_BUILD_SETUP**
     
  8. roohandehmahdi

    roohandehmahdi

    Joined:
    Aug 29, 2019
    Posts:
    1
    Greate, it's work for me too.
     
  9. unity_wYUNF68nPnwVSA

    unity_wYUNF68nPnwVSA

    Joined:
    Apr 7, 2020
    Posts:
    1
    is this issue solved?
     
  10. a572014136

    a572014136

    Joined:
    Apr 29, 2020
    Posts:
    3
    it do not use:(
     
  11. a572014136

    a572014136

    Joined:
    Apr 29, 2020
    Posts:
    3
    I solved it by create a apk named this in where it wrong...
     
  12. a572014136

    a572014136

    Joined:
    Apr 29, 2020
    Posts:
    3
    But it can't run...
     
  13. ajeets1978

    ajeets1978

    Joined:
    Mar 10, 2019
    Posts:
    15
    Same issue here.


    FileNotFoundException: Temp\gradleOut\build\outputs\bundle\release\gradleOut.aab does not exist
    System.IO.File.Move (System.String sourceFileName, System.String destFileName) (at <e1319b7195c343e79b385cd3aa43f5dc>:0)
    UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <d81019dc6c27464f877727b99655b6a9>:0)
    UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <d81019dc6c27464f877727b99655b6a9>:0)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <d81019dc6c27464f877727b99655b6a9>:0)
    UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <d81019dc6c27464f877727b99655b6a9>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:288)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
     
  14. ajeets1978

    ajeets1978

    Joined:
    Mar 10, 2019
    Posts:
    15
    I have no idea why Unity people didn't yet respond on this.

    I can see the .aab file on that location but its not names as it is looking for while building instead of gradleOut.aab the file name there is gradleOut-release.aab.

    I have renamed it and lets see if it works.
     
  15. ajeets1978

    ajeets1978

    Joined:
    Mar 10, 2019
    Posts:
    15
    Renaming didn't work :( as it cleans and creates a new file named gradleOut-release.aab ? Does anyone have any solution?
     
  16. marcin-matczak

    marcin-matczak

    Joined:
    Sep 5, 2018
    Posts:
    10
    I have the same issue: Unity Cloud Build, Latest 2018.4
     
  17. kdeger

    kdeger

    Joined:
    Mar 4, 2018
    Posts:
    20
    Hey everybody, following this post https://forum.unity.com/threads/bun...s-not-exist-2019-4-16f1.1025302/#post-6780950 and some other forum posts I have finally able to build aab.
    Code (CSharp):
    1.     tasks.whenTaskAdded { task ->
    2.         if (task.name.startsWith("bundle")) {
    3.             def renameTaskName = "rename${task.name.capitalize()}Aab"
    4.             def flavor = task.name.substring("bundle".length()).uncapitalize()
    5.             tasks.create(renameTaskName, Copy) {
    6.                 def path = "${buildDir}/outputs/bundle/${flavor}/"
    7.                 from(path)
    8.                 include "gradleOut-release.aab"
    9.                 destinationDir file("${buildDir}/outputs/bundle/${flavor}/")
    10.                 rename "gradleOut-release.aab", "gradleOut.aab"
    11.             }
    12.    
    13.             task.finalizedBy(renameTaskName)
    14.         }
    15.     }
    Add this code to mainTemplate, inside the bottom of defaultConfig. This works for Unity versions without the option to create custom launcherTemplate.gradle, if you have the option to create launcherTemplate.gradle, you can paste this code to the bottom of it.

    Hope this helps.
     
  18. utsavappindia

    utsavappindia

    Joined:
    Mar 26, 2019
    Posts:
    7
    Hi, I am working project on Unity version 2020.2.6f1. But when I build AAB for my project, the build gets failed & gets an Error Log.

    Here is the Error log :
    FileNotFoundException: Temp/gradleOut/launcher/build/outputs/bundle/release/launcher-release.aab does not exist.

    Please Help to Resolve this problem.
     
unityunity