# Ionic make archive instead build

**URL:** <https://forum.ionicframework.com/t/ionic-make-archive-instead-build/72737>\
**Category:** ionic-v1\
**Created:** [December 9, 2016, 9:44am UTC](https://forum.ionicframework.com/t/ionic-make-archive-instead-build/72737 "2016-12-09T09:44:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trazius](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@Trazius](https://forum.ionicframework.com/u/Trazius)\
**Post date:** [December 9, 2016, 9:44am UTC](https://forum.ionicframework.com/t/ionic-make-archive-instead-build/72737/1 "2016-12-09T09:44:43Z")

</div>

I have a project which is being developed with other developer. A couple of days ago, after git pull, make some changes and I typed ‘ionic build ios’, as many times before.  
And I get error \*\* ARCHIVE FAILED \*\*. (Android works)

What happened is not clear. But I found that this happens with new projects too.  
For example, create new project:

> ‘ionic start testState blank’  
> ‘ionic build ios’  
> ` **BUILD SUCCEEDED** `

But, if you did  
‘ionic state reset’ or ‘ionic state clear’ and try build  
you get something like this:  
`Error: Source path does not exist: resources/ios/icon/icon-40@3x.png`

`'ionic resources'`  
and again  
` 'ionic build ios'`

and now you get:  
\*\* ARCHIVE FAILED \*\*

```
The following build commands failed:
	Check dependencies
(1 failure)

Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Trazius/WebstormProjects/testState/platforms/ios/cordova/build-debug.xcconfig,-workspace,testState.xcworkspace,-scheme,testState,-configuration,Debug,-destination,generic/platform=iOS,-archivePath,testState.xcarchive,archive,CONFIGURATION_BUILD_DIR=/Users/Trazius/WebstormProjects/testState/platforms/ios/build/device,SHARED_PRECOMPS_DIR=/Users/Trazius/WebstormProjects/testState/platforms/ios/build/sharedpch

```

Sometimes, if you make some changes in project, you can get:  
\*\* ARCHIVE SUCCEEDED \*\*

```
Exported testState App.xcarchive to: /Users/Trazius/WebstormProjects/testState/platforms/ios/build/device

**EXPORT SUCCEEDED**

```

I didn’t see this trouble earlier, how I can return normal build from project?

---

<div class="post-metadata">

**Author:** ![Jacobcarter](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jacobcarter/32/106137_2.png) [@Jacobcarter](https://forum.ionicframework.com/u/Jacobcarter)\
**Post date:** [January 18, 2017, 3:03am UTC](https://forum.ionicframework.com/t/ionic-make-archive-instead-build/72737/2 "2017-01-18T03:03:41Z")

</div>

After trying tons of things this is what I had to do to get things back to normal:

- Globally unistall ionic and cordova
- Delete git repo locally and re-clone
- Run npm install
- `cordova platform add ios`
- manually add all plugins (found in package.json)
- `cordova plugin add cordova-plugin-x`
- `ionic build ios` is now behaving as expected.

This was a nightmare and I will never use `ionic state X` again ☹

---

<div class="post-metadata">

**Author:** ![feliciegodineau](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/feliciegodineau/32/108423_2.png) [@feliciegodineau](https://forum.ionicframework.com/u/feliciegodineau)\
**Post date:** [April 12, 2017, 1:07pm UTC](https://forum.ionicframework.com/t/ionic-make-archive-instead-build/72737/3 "2017-04-12T13:07:35Z")

</div>

Hello !  
I tried what you said and it worked for 3 builds then Ionic started archiving my project again …  
Do you have another solution ? Do you know why Ionic have this behavour ?

EDIT :  
I noticed that Ionic built correctly the app when my phone wasn’t plug.  
I have to add the option --emulator to get ionic build to build correctly (ionic build --emulator ios)

---

<div class="post-metadata">

**Author:** ![jakob.p](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jakob.p](https://forum.ionicframework.com/u/jakob.p)\
**Post date:** [June 8, 2017, 1:45pm UTC](https://forum.ionicframework.com/t/ionic-make-archive-instead-build/72737/4 "2017-06-08T13:45:37Z")

</div>

For me building also only works if the device is not plugged. Otherwise it will archive. Did you find a solution to this?

---

<div class="post-metadata">

**Author:** ![feliciegodineau](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/feliciegodineau/32/108423_2.png) [@feliciegodineau](https://forum.ionicframework.com/u/feliciegodineau)\
**Post date:** [June 8, 2017, 1:57pm UTC](https://forum.ionicframework.com/t/ionic-make-archive-instead-build/72737/5 "2017-06-08T13:57:05Z")

</div>

Use the flag --emulator 🙂

---

<div class="post-metadata">

**Author:** ![naveentere7](https://avatars.discourse-cdn.com/v4/letter/n/9f8e36/32.png) [@naveentere7](https://forum.ionicframework.com/u/naveentere7)\
**Post date:** [October 12, 2017, 4:11pm UTC](https://forum.ionicframework.com/t/ionic-make-archive-instead-build/72737/6 "2017-10-12T16:11:38Z")

</div>

```auto
ionic build ios --emulator

```

Works fine for me 🙂
