# Splitting BITRISE\_APK\_PATH\_LIST issue

**URL:** <https://discuss.bitrise.io/t/splitting-bitrise-apk-path-list-issue/2382>\
**Category:** Question & Answer\
**Tags:** deploy\
**Created:** [July 29, 2017, 10:03pm UTC](https://discuss.bitrise.io/t/splitting-bitrise-apk-path-list-issue/2382 "2017-07-29T22:03:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![raphaelmina](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/raphaelmina/32/419_2.png) [@raphaelmina](https://discuss.bitrise.io/u/raphaelmina)\
**Post date:** [July 29, 2017, 10:03pm UTC](https://discuss.bitrise.io/t/splitting-bitrise-apk-path-list-issue/2382/1 "2017-07-29T22:03:11Z")

</div>

I’m trying to take advantage of the recent BITRISE\_APK\_PATH\_LIST, and to export each APK path of my flavors in a single evironnement variable. I’m having an issue when trying to use it in other steps.

Here is what I get from Gradle step :

> The apk paths list is now available in the Environment Variable: $BITRISE\_APK\_PATH\_LIST (value: /bitrise/deploy/xxx-dev-release.apk|/bitrise/deploy/xxx-prod-release.apk)

I split then the list in a script with :

> IFS=‘|’ tokens=($BITRISE\_APK\_PATH\_LIST)  
> echo ${tokens[0]}|envman add --key APK\_PATH\_FLAVOR\_0;echo ${tokens[1]}|envman add --key APK\_PATH\_FLAVOR\_1;

I now have two variables, APK\_PATH\_FLAVOR\_0 & APK\_PATH\_FLAVOR\_1. I use them in two “Deploy to bitrise” steps, but I have the following error :

> Configs:
> 
> - BuildURL: [https://www.bitrise.io/build/48c88955ae414a7f](https://www.bitrise.io/build/48c88955ae414a7f)
> - APIToken: sqxQTKOP0EJMtvancWhHlA
> - IsCompress: false
> - DeployPath: /bitrise/deploy/xxx-dev-release.apk
> - NotifyUserGroups: everyone
> - NotifyEmailList:
> - IsPublicPageEnabled: true  
> Issue with input: DeployPath - path not exist at: /bitrise/deploy/xxx-dev-release.apk

The step is successfull if I hardcode the “/bitrise/deploy/xxx-dev-release.apk” instead of using the variable generated by envman.

Any idea ?

Thanks in advance,

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [July 30, 2017, 6:59am UTC](https://discuss.bitrise.io/t/splitting-bitrise-apk-path-list-issue/2382/2 "2017-07-30T06:59:24Z")

</div>

Hi @raphaelmina,

Please start your script with `set -ex` for debug logs. Eg

```auto
#!/bin/bash
set -ex

echo 'hi' 

```

If that wouldn’t help to find the issue then please copy paste the scripts log from the build log.

---

<div class="post-metadata">

**Author:** ![raphaelmina](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/raphaelmina/32/419_2.png) [@raphaelmina](https://discuss.bitrise.io/u/raphaelmina)\
**Post date:** [July 30, 2017, 2:11pm UTC](https://discuss.bitrise.io/t/splitting-bitrise-apk-path-list-issue/2382/3 "2017-07-30T14:11:06Z")

</div>

Hi @viktorbenei,

Thanks for the tip. I figured out what was the issue, without understanding the cause.

Here is the output of my “tokenize” step, after adding set -ex :

```
+ IFS='|'
+ tokens=($BITRISE_APK_PATH_LIST)
+ echo /bitrise/deploy/xxx-dev-release.apk
+ envman add --key APK_PATH_FLAVOR_0
+ echo /bitrise/deploy/xxx-prod-release.apk
+ envman add --key APK_PATH_FLAVOR_1

```

I think somehow, a line feed is inserted after each of my APK path, because I observe a line feed in my deploy path :

 ![](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/1X/4f4e61a831812b5570f7c0786f2c6e47ce3d89ee.png)

I tried to change the way I used envman, to this form :  
` envman add --key APK_PATH_FLAVOR_0 --value ${tokens[0]}`

And this time the deploy step can find my APK, and there’s no line feed in my deploy path. I don’t get the cause, but apparently that’s fine now. If you have any explanation, I’m curious to hear it !

Thanks for your help,

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [July 30, 2017, 2:43pm UTC](https://discuss.bitrise.io/t/splitting-bitrise-apk-path-list-issue/2382/4 "2017-07-30T14:43:27Z")

</div>

That indeed can happen if you use **`echo`**.

`echo` without the `-n` flag does add a newline to the end. To not to add a newline / line feed char to the end you should use `echo -n` or `printf`, or as you discovered just use the **`envman --key X --value VALUE`** format of envman, instead of the pipe input format.

---

<div class="post-metadata">

**Author:** ![raphaelmina](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/raphaelmina/32/419_2.png) [@raphaelmina](https://discuss.bitrise.io/u/raphaelmina)\
**Post date:** [July 30, 2017, 5:06pm UTC](https://discuss.bitrise.io/t/splitting-bitrise-apk-path-list-issue/2382/5 "2017-07-30T17:06:07Z")

</div>

Thanks a lot @viktorbenei ! I got the point !
