Error: Not a file
So, after fixing all of the issues with the Facebook plugin, I went to sleep. I was tired. It was like 6:00 am. I woke up around 11:oo am or so, fed my dog and took her outside for a bit. Made my boyfriend and me some yummy breakfast. Then I sat down to start working on my Epicurus Unvorsum Unity project.
I made a build, or at least attempted to. An Error popped up in my Console, stating that the APK file could not be created. Then gave the path to where I store my Epicurus Unvorsum unity project files with “Error: Not a file”.
All I could think was, oh my gosh. What the hell is this. Freak out mode turned on. After pacing for a few minutes, thinking about what I did with the project last night, I sat back down at my computer.
I needed to write a few blog posts, so since I knew I get write them without causing any errors, I wrote them. Then I took a look at my Unity project again.
Options to Solve Unity Building Error: Not a file
My first thought was to check to make sure nothing crazy happened, and that the path to my project still existed. I opened up the folders to where my project was stored to make sure it was still there. It was. A little bit of panic relief. This showed me that the error was with Unity, and not my path to my project. Time to Google Search, since I had never dealt with an issue like this before.
I came across several Unity forum posts in the Answers section, with several suggestions on what to do:
- Delete a possible duplicate .jar file
- Check that your keystore file is properly linked in the Player Settings
- Re-import all of your assets files
- Update/Downgrade your Android SDK version
- Re-sync project directory from source control
- Make sure your plugin is not a bad one
- Check that a .jar file is not corrupted
- Restart Unity
I started with checking for a duplicate .jar file. I have run into this issue before with plugins, so it seemed logical that this might be the issue. I did a search for .jar files in my project folder. Looked over all of them, but found no duplicates.
Since the most recent change that I had done with my Unity project had to do with keystore files, I thought that maybe my keystore file that I had created for the project had become unlinked some how. So, in my Unity editor, I went to File > Build Settings and clicked the Player Settings button. My keystore file looked like it was properly linked. But, just in case, I clicked the Browse Keystore button, and selected my keystore file that I had created for my project. I tried to create a new build. It seemed to work, since this time, a build was created, but the errors were still appearing in my console. I deleted my old build from my mobile device, and then restarted it. I then installed the new build, and an error popped up during the installation stating that the build could not be installed. I assumed the issue was not solved, so I moved on.
I skipped doing the re-importing my asset files. This seemed like it might take a while or maybe cause other issues. So, I figured I’d save that for if other options didn’t work.
The updating or downgrading my Android SDK version, while may work for some, didn’t seem like it would be what was causing this issue for me. About a week ago, I had done a fresh install of Windows 7, in which I formatted my operating system drive. I also run all of my software installations from the same drive. So, I know that when I reinstalled everything, it was all up to date. I haven’t had any issues with my Android SDK version being wrong yet, so that did not seem like a good way to solve my issue, for me.
Re-syncing my project directory from source control was not relevant for me, since I am not using any software to sync my files. For more on this way to resolve the issue, please see the answer from seandanger.
The only plugin that I am using in my code, right now, is a plugin from Facebook Developers to integrate the game to Facebook. Since, basically all developers that create apps for Facebook use this plugin, I made an educated guess that the plugin was correct. It is however, possible that it may have gotten corrupted when I downloaded it, so I didn’t dismiss this option, but I thought I’d try it last since deleting and re-installing a plugin is a pain.
It was very possible that one of my .jar files could be corrupted, but this option would be time consuming. My project has several.jar files, and checking each one would take a while. So, I thought I’d try the easiest solution, first.
Since I had already tried the most obvious solutions, and they didn’t work, I thought I’d try a simple restart method. Literally, all you do is close Unity, and then restart it. This solved my issue. I created a build, installed it on my mobile device, and everything is running just fine.
Now, I got the restart Unity idea from seandanger’s response on the forum. Unity runs on my C: drive, but all of my project files are stored on my D: drive. So, I thought with all the path finding and things I did with the Facebook Plugin last night, something may have gotten lost, and I just needed to re-establish the link. In seandanger’s response, he mentioned that he had to restart Unity more than once. I only needed to restart one time to fix it.
Anyways, I hope this helps someone else who runs into this issue. If you do run into this issue, I’d love to know how you solved it! Post your solution in the comments below!
Also, if you find any issues with things, or have any suggestions, I would love to hear them! Email me here or report an issue or bug here.
I love to be social with you all! Don’t forget to follow Eimear Studios on Facebook, Google+ and Twitter! I have lots of socialness to share, there’s more at the top right of this page!