Run Your Ionic App on an Android Phone Step By Step: Using Your Phone as a Wireless Emulator with Wi-Fi Debugging Only
Tags: android, androidstudio, ionic
Published: 2023-05-31 15:14:49

first we need to turn our phone to Mode developer and we should have android studio and Ionic installed in our machine 

follow those step to rach our goal and run our app direclty in our phone :
 
**

## wirless debuging
**

for using wirless debuging  we need to install scrcpy

if you don't have it yet in your machine 

now go to github and Download 

[scrcpy](https://github.com/Genymobile/scrcpy/blob/master/doc/windows.md)

open your powershell : 

```javascript
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2q582kcijrrgaj20qec2.png)


```javascript
scoop install scrcpy
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v1u835gd8r7giunu5yu1.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r82w7yblr4tog3rxobkf.png)



```javascript
scoop install adb
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2mb0ogti3l8m7ysy1j9.png)




and go to path and add adb  C:\Users\Huawei\Downloads\scrcpy-win64-v2.0 (1)\scrcpy-win64-v2.0



to run mobile with your laptop go in powershell : 

connect your phone first using USB Debugging

```javascript
adb  tcpip 5555
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nd3mylg00o1d5qpnagfa.png)



now disconnect your phone ( removing USB )


go to about in phone and get ip adress connected to wifi

```javascript
adb connect ipaddresswifi:5555
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6o3mk8brkfr8wd7o20c3.png)




then run :  

```javascript
scrcpy
```



![scrcpy](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7np4v1kwqy70uudr323.png)



now let open our ionic project in vs Code and run the following Command Line : 


```javascript
ionic build --prod
```

![ionic build --prod](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b30tvtbfsr0budvc62ef.png)


```javascript
npm install @capacitor/android --force
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0djhu842mxmutpxytnrx.png)


Run the following command to add the Android platform to your project:


```javascript
 npx cap add android
```


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/orfjz3nh6g94g7hrh8mc.png)


Next, run the following command to synchronize your project with the added platform:

This will ensure that the necessary files and dependencies are updated in your Android project.


```javascript
npx cap sync android
```


Once the synchronization is complete, you can proceed with opening your Android project in Android Studio by running the following command:

```javascript
npx cap open android
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t6rdblk4ta58xxrg3zrv.png)


![npx cap open android](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k8vg8dsas3peig1bmb3z.png)



![trust project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fvht7e7il2z904njbirk.png)



![waiting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7j71gi5kkajq7qb0vy78.png)




In Android Studio, click on the "Run" menu and select "Run 'app'".



![Result](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iemv59hgj1nrkfuwzl7n.png)




I hope you find this tutorial helpful.