Question: I want to fetch the clientroot of perforce in a perl script.

I wrote the code as :

```
my $workspace_root=system("p4 client -o | findstr /b Root");
print $workspace_root;

```

Instead of printing the path, it prints `0`

Could anyone please tell what I am missing here?

Answer: 
This issue seems to be bug in Android Studio.

I tried all other workarounds but the issue was appearing randomly. 

I also have custom named apk for output. But Android studio was randomly picking custom apk name and default apk name.

Adding **Gradle-aware Make** solved the issue.

Following are the steps.

1. Menu **Run -> Edit Configuration**
2. Select "app" configuration
3. **Add** **Gradle-aware Make** to **Before Launch** actions

You are done.

[![enter image description here](https://i.stack.imgur.com/yAn0Y.png)](https://i.stack.imgur.com/yAn0Y.png)

[![enter image description here](https://i.stack.imgur.com/f4mVm.png)](https://i.stack.imgur.com/f4mVm.png)

[![enter image description here](https://i.stack.imgur.com/7sqzd.png)](https://i.stack.imgur.com/7sqzd.png)

Following article helped me in finding the solution
<https://android.jlelse.eu/android-studio-3-1-how-to-fix-it-b49f72eb054f>
Trying cleaning AND rebuilding your project: In Android Studio, open up the Build tab at the top left and try both the Clean and Rebuild options.