# Spark Dev: app code was invalid

**URL:** <https://community.particle.io/t/spark-dev-app-code-was-invalid/8289>\
**Category:** Cloud\
**Created:** [November 20, 2014, 7:59am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289 "2014-11-20T07:59:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mihirt](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@mihirt](https://community.particle.io/u/mihirt)\
**Post date:** [November 20, 2014, 7:59am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/1 "2014-11-20T07:59:36Z")

</div>

Hello,  
I’m trying to use the Spark Dev Mac app (latest release) to upload code. However, anytime I try to compile the code, I get an error at the bottom which says “App code was invalid.” When i clicked on it, the panel that shows up at the top said no compile errors. I tried this with the blink program that comes with the core, and it did not work as well.

[![](http://puu.sh/cYcuR/f5ee9d49c4.png) ](http://puu.sh/cYcuR/f5ee9d49c4.png)[![](http://puu.sh/cYcwG/c25a815833.png) ](http://puu.sh/cYcwG/c25a815833.png)

Thanks,  
Mihir

---

<div class="post-metadata">

**Author:** ![Allak](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Allak](https://community.particle.io/u/Allak)\
**Post date:** [November 20, 2014, 2:41pm UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/2 "2014-11-20T14:41:41Z")

</div>

same problem over here (Macbook Pro Retina 13 (mid2014))

---

<div class="post-metadata">

**Author:** ![mad0r](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@mad0r](https://community.particle.io/u/mad0r)\
**Post date:** [November 20, 2014, 7:01pm UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/3 "2014-11-20T19:01:30Z")

</div>

Same here, using Windows 8.1 64Bit ☹

---

<div class="post-metadata">

**Author:** ![arniew](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@arniew](https://community.particle.io/u/arniew)\
**Post date:** [November 24, 2014, 1:48am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/4 "2014-11-24T01:48:38Z")

</div>

Yes, same issue. Windows 8.1 64bit

EDIT: Autodetect defaults to plain text so I need to manually select C++ to get syntax highlighting. After compile it goes back to plain text.

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [November 24, 2014, 1:56am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/5 "2014-11-24T01:56:49Z")

</div>

Great feedback! Can you send a feedback via the Spark dev or open an issue at [https://github.com/spark/spark-dev](https://github.com/spark/spark-dev)? 🙂

---

<div class="post-metadata">

**Author:** ![mihirt](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@mihirt](https://community.particle.io/u/mihirt)\
**Post date:** [November 24, 2014, 3:56am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/6 "2014-11-24T03:56:30Z")

</div>

Were you able to get it to compile and upload this way, @arniew?

---

<div class="post-metadata">

**Author:** ![arniew](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@arniew](https://community.particle.io/u/arniew)\
**Post date:** [November 24, 2014, 4:35am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/7 "2014-11-24T04:35:44Z")

</div>

@ mihirt - compile and upload ‘what’ way? Do you mean saving to a clean folder? I tried that but it still does not work. I’ve also tried some basic code ‘Blink LED’ without referencing libraries.

---

<div class="post-metadata">

**Author:** ![rog3r](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rog3r/32/3698_2.png) [@rog3r](https://community.particle.io/u/rog3r)\
**Post date:** [November 25, 2014, 8:43am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/8 "2014-11-25T08:43:15Z")

</div>

I had the same problem.  
But I think it’s because you have more files in your project directory.

Try moving the files of your project in one folder, (only the ones you need, libraries, etc.)  
Then restart the SparkDev Editor, and now open your file from the new directory.

This worked for me.

---

<div class="post-metadata">

**Author:** ![mtnbrit](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/mtnbrit/32/4753_2.png) [@mtnbrit](https://community.particle.io/u/mtnbrit)\
**Post date:** [November 28, 2014, 9:13pm UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/9 "2014-11-28T21:13:09Z")

</div>

I notice you can’t even use any directories under the root, just your .ino and all your libs .cpp and .h files need to be under the root folder for it to compile, at least on the mac version that appears to be the case.

---

<div class="post-metadata">

**Author:** ![cayuse](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@cayuse](https://community.particle.io/u/cayuse)\
**Post date:** [December 3, 2014, 6:24pm UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/10 "2014-12-03T18:24:42Z")

</div>

@mihirt, in your screenshot it appears the file is correctly named, but you will get the same generic error if the sketch is not saved with a ‘.ino’ extension.

Also, there can be only a single .ino file in the directory. The compiler seems to be quite picky about the file system structure, as also pointed out by rog3r and mtnbrit.

---

<div class="post-metadata">

**Author:** ![Leonardo](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/leonardo/32/3769_2.png) [@Leonardo](https://community.particle.io/u/Leonardo)\
**Post date:** [December 9, 2014, 2:20am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/11 "2014-12-09T02:20:27Z")

</div>

Is there a fix for this yet? I just realize I am also facing this problem on my windows 8.1 64bit. Currently using the web version to do it. =/

---

<div class="post-metadata">

**Author:** ![harrisonhjones](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/harrisonhjones/32/4132_2.png) [@harrisonhjones](https://community.particle.io/u/harrisonhjones)\
**Post date:** [December 9, 2014, 5:43pm UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/12 "2014-12-09T17:43:01Z")

</div>

@Leonardo are your files either .cpp or .h files? I get this error only if I don’t have them properly extension-ed

---

<div class="post-metadata">

**Author:** ![Leonardo](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/leonardo/32/3769_2.png) [@Leonardo](https://community.particle.io/u/Leonardo)\
**Post date:** [December 10, 2014, 3:47am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/13 "2014-12-10T03:47:44Z")

</div>

I only have a .ino for the core. I do not have any #includes.

---

<div class="post-metadata">

**Author:** ![harrisonhjones](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/harrisonhjones/32/4132_2.png) [@harrisonhjones](https://community.particle.io/u/harrisonhjones)\
**Post date:** [December 10, 2014, 4:47pm UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/14 "2014-12-10T16:47:19Z")

</div>

Just to humor me would you mind renaming the .ino to a .cpp?

---

<div class="post-metadata">

**Author:** ![Leonardo](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/leonardo/32/3769_2.png) [@Leonardo](https://community.particle.io/u/Leonardo)\
**Post date:** [December 11, 2014, 1:44am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/15 "2014-12-11T01:44:12Z")

</div>

@harrisonhjones I was about to do that hahaha. But anyway it is working for me already. Reading @cayuse and @rog3r posts I realize that even .html or .js files cannot be inside as well.

The folder must be plain empty except for the .ino file that I am using… Really very picky program hahaha.

---

<div class="post-metadata">

**Author:** ![matan](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@matan](https://community.particle.io/u/matan)\
**Post date:** [December 28, 2014, 1:59pm UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/16 "2014-12-28T13:59:37Z")

</div>

I had also the same problem, solved in the same way. I use git as version control of my code, but it didn’t work until I moved it to new folder without the .git files.

Any idea how to use git version control without interrupt Spark dev to compile and flash?

By the way, I am using win7, so it’s not just win8/win8.1 problem.

---

<div class="post-metadata">

**Author:** ![Leonardo](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/leonardo/32/3769_2.png) [@Leonardo](https://community.particle.io/u/Leonardo)\
**Post date:** [December 30, 2014, 1:59am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/17 "2014-12-30T01:59:46Z")

</div>

Hi @matan I am not too sure about .git files. :x I always do this normal #includes like

```
#include "flashee-eeprom.h"
```

---

<div class="post-metadata">

**Author:** ![StuartK](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@StuartK](https://community.particle.io/u/StuartK)\
**Post date:** [March 1, 2015, 2:04am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/18 "2015-03-01T02:04:39Z")

</div>

I’m able to get simple projects working if I create a folder call “Projects” in my Spark Dev folder. I then save the files to that folder and put the extension .ino at the end of the saved file manually.

.cpp gives a zillion errors and .h flashes but nothing happens.

---

<div class="post-metadata">

**Author:** ![frlobo](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/frlobo/32/1279_2.png) [@frlobo](https://community.particle.io/u/frlobo)\
**Post date:** [March 9, 2015, 8:51am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/19 "2015-03-09T08:51:09Z")

</div>

A clean directory is needed like it is stated here above… The bad ugly thing is that it makes it hard to keep version control for git… Since git uses directories inside the project directory!!!

---

<div class="post-metadata">

**Author:** ![damccull](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/damccull/32/20705_2.png) [@damccull](https://community.particle.io/u/damccull)\
**Post date:** [March 16, 2015, 12:22am UTC](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289/20 "2015-03-16T00:22:55Z")

</div>

Ran into this issue. Would love to see it fixed.

[Next page](https://community.particle.io/t/spark-dev-app-code-was-invalid/8289.md?page=2)
