# Android Unable to generate libs for Android Client

**URL:** <https://forums.rocket.chat/t/android-unable-to-generate-libs-for-android-client/4686>\
**Category:** Community Support\
**Created:** [September 27, 2019, 6:40am UTC](https://forums.rocket.chat/t/android-unable-to-generate-libs-for-android-client/4686 "2019-09-27T06:40:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shri](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Shri](https://forums.rocket.chat/u/Shri)\
**Post date:** [September 27, 2019, 6:40am UTC](https://forums.rocket.chat/t/android-unable-to-generate-libs-for-android-client/4686/1 "2019-09-27T06:40:38Z")

</div>

Hi Team,

I am able to setup the Android client project but I am facing issue in setting Android SDK project.

I am unable to generate JAR files after following below procedure which is from Rocket chat documentation.

Change the current directory to `Rocket.Chat.Android/app` and run the `build-sdk.sh`

Error Occurrence:

1)When I run the build-sdk.sh command it will open notepad with below data in it

#!/bin/bash

CURRENT\_DIR=(pwd) GIT=(which git)

if [“$#” -eq 1] && [! -z “1"]; then # if in an argument is given this is the (relative) path to SDK\_DIR SDK\_DIR=(readlink -f 1) else # The SDK dir should be 2 directories up in the tree, so we use dirname 2 times # to get the common parent dir of the SDK and the app cd ../.. tmp=(pwd)  
SDK\_DIR=”tmp/Rocket.Chat.Kotlin.SDK" cd "{CURRENT\_DIR}"  
fi

echo “CURRENT DIR: $CURRENT\_DIR”  
echo “SDK DIR: $SDK\_DIR”

# check if there are changes not committed

function git\_stat {  
local resultVar=1 cd "{SDK\_DIR}" && “{GIT}" diff --shortstat --exit-code eval {resultVar}=”’$?’"  
}

# check for changes already on the index not committed

function git\_stat\_cached {  
local resultVar=1 cd "{SDK\_DIR}" && “{GIT}" diff --cached --shortstat --exit-code eval {resultVar}=”’$?’"  
}

# get the SHA of the latest commit

function git\_sha {  
temp\_sha=(cd "{SDK\_DIR}" && “${GIT}” rev-parse --short HEAD)  
echo “$temp\_sha”  
}

function git\_app\_branch {  
temp\_branch=(cd "{CURRENT\_DIR}" && “${GIT}” rev-parse --abbrev-ref HEAD)  
echo “$temp\_branch”  
}

# check if the tree is dirty (has modifications not committed yet)

function check\_git\_dirty {  
git\_stat stat  
git\_stat\_cached cached

```
if [${stat} -eq 0] && [${cached} -eq 0]; then
	echo "not dirty"
	return 1
else
	echo "is dirty"
	return 0
fi

```

}

# check if the saved last commit is the same as the latest SHA in the tree

function check\_last\_commit {  
if [! -f {SDK\_DIR}/.last\_commit\_hash]; then echo "last\_commit\_hash not found" return 0 fi saved\_hash=(cat "{SDK\_DIR}"/.last\_commit\_hash) last\_hash=(git\_sha)  
#`cd $SDK_DIR && git rev-parse --short HEAD`  
if [“$saved\_hash” == “$last\_hash”]; then  
echo “same hash as before $saved\_hash = $last\_hash”  
return 1  
fi

```
echo "different commits, build again"
return 0

```

}

function checkout\_matching\_branch {  
app\_branch=(git\_app\_branch) cd "{SDK\_DIR}" && “{GIT}" checkout "{app\_branch}” 1\>/dev/null 2\>/dev/null  
}

checkout\_matching\_branch

SHA=$(git\_sha)  
if [“X$SHA” == “X”]; then  
SHA=“0.1-SNAPSHOT”  
fi  
echo “CURRENT SHA: $SHA”

# if the tree is not dirty, there is no new commit and the .jars are still there, just skip the build

if ! check\_git\_dirty && ! check\_last\_commit && [-f “{CURRENT\_DIR}"/libs/common-"{SHA}”.jar] && [-f “{CURRENT\_DIR}"/libs/core-"{SHA}”.jar]; then  
echo “NO BUILD NEEDED”  
exit 0  
fi

cd “{SDK\_DIR}" && ./gradlew --no-daemon common:assemble && cd "{CURRENT\_DIR}”  
cd “{SDK\_DIR}" && ./gradlew --no-daemon core:assemble && cd "{CURRENT\_DIR}”

rm “{CURRENT\_DIR}"/libs/common\* "{CURRENT\_DIR}”/libs/core\*

mkdir -p “{CURRENT\_DIR}"/libs/ cp -v "{SDK\_DIR}”/common/build/libs/common-0.1-SNAPSHOT.jar “{CURRENT\_DIR}"/libs/common-"{SHA}”.jar  
cp -v “{SDK\_DIR}"/core/build/libs/core-0.1-SNAPSHOT.jar "{CURRENT\_DIR}”/libs/core-"${SHA}".jar

echo “SHA" \> "{SDK\_DIR}”/.last\_commit\_hash

exit 0
