Building Error: Not a file ?

I get this error in the middle of ‘Build and Run’ of the app for test on my phone.
The app works fine on the Unity simulator. I copied this app from another one and modifying some parts. (from Javascript to C#).
What would give this error? Any comments would be vert appreciated. Thanks.

Error msg is …

Error: Not a file ‘/Users/davidkim/DHK/Unity3D/USLottery’

UnityEditor.HostView:OnGUI()

Error building Player: CommandInvokationFailure: Failed to build apk. See the Console for details.
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java -Xmx1024M -Dcom.android.sdkmanager.toolsdir=“/Users/davidkim/android-sdks/tools” -Dfile.encoding=UTF8 -jar “/Applications/Unity/Unity.app/Contents/BuildTargetTools/AndroidPlayer/sdktools.jar” -

stderr[
Error: Not a file ‘/Users/davidkim/DHK/Unity3D/USLottery’
]
stdout[

]

I got this error when I forgot to select a keystore. I entered my password thinking my keystore was still selected. And I thought it could sign but apparently it couldn’t. This happened after I did a new checkout from SVN. Hope it helps.

For me it was a keystore issue – I had selected ‘browse’ and then realized it had the right keystore selected, so I canceled out of the file selector. However, it was too late, Unity had already cleared the old path, so it wasn’t pointing to any keystore anymore (and I didn’t notice).

I solved it by browsing for my keystore again. Try this.

I fixed this bug by making a new Unity project and copying all the assets into it.

Other solutions from around the web, none of which worked for me:

  • Re-Import all your assets using “Re-Import All”
  • Update/Downgrade your Android SDK version. Sometimes Unity doesn’t keep up with the current Build Tools version.
  • Remove duplicate “.jar” files in your project.

I don’t have a real answer because I’m not sure why the error went away, but I’ll detail what I did in case it helps anyone in the future.

I was able to build successfully, seemingly changed nothing, and then started getting this error after a machine reboot. Here’s what I did:

  • Tried Re-Import All (no change).
  • Changed my Android minimum API level to a lower level API (no change).
  • Re-synced project directory from source control (see below).

I use Perforce for source control and thought maybe it might be giving Unity some trouble, so I closed Unity, force synced my repo to the head revisions, then opened Unity again and built – no change, error still happened.

Then I closed Unity one more time, opened it, built, and success. No idea why. Like I said, I doubt it’ll help others, but just in case!

Keystore folder.

In sdk folder - building tools - copy the “zipalign” file and paste tin tools folder and then export ti android,

http://fogbugz.unity3d.com/default.asp?616836_ktt4nn6jh91dds23

See this

Reselect your keystore file.
And it will work!

It happened to me when I forgot to relocate my keystore file when I tried to build apk from my game.