I would like to compile Android Apps with SDK 23.0.3 as a user on CentOS. Unfortunately, everytime build-tools/23.0.3/aapt
is run, it returns
bash: build-tools/23.0.3/aapt: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
The problem seems to be that 32 bit libraries need to be installed. If I have sudo rights (on Ubuntu), I can run sudo apt install libc6-i386 lib32stdc++6 lib32gcc1
(like described in CentOS 64 bit bad ELF interpreter), but unfortunately, I do not have sudo on the machine where I would like to compile.
I assumed that I could get the used libraries (like described in https://www.cs.virginia.edu/~dww4s/articles/ld_linux.html) and then replace the used libraries by setting LD_LIBRARY_PATH
(like described in http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html). I extracted the libraries by
ldd ../androidsdk/build-tools/23.0.3/aapt | \
grep "i386" | awk '{print $3}' | \
while read file
do cp $file .
done
and copied them to /home/test
. Then I ran export LD_LIBRARY_PATH=/home/test
, but then aapt
returns the same error.
Another thing I tried was getting and extracting the libraries (on Ubuntu):
apt-get download libc6-i386 lib32stdc++6 lib32gcc1
for file in *.deb
do dpkg -x $file .
done
And aftwards setting the LD_LIBARY_PATH to /home/test/lib:/home/test/lib32
, which also did not work.
This could be reproduced by a docker container: running docker run -it ubuntu bash
and then
apt update && apt install git unzip wget openjdk-8-jdk
cd home/
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip
cd tools/
yes | bin/sdkmanager --install "build-tools;23.0.3"
cd ..
For setup. Then, build-tools/23.0.3/aapt
returns
bash: build-tools/23.0.3/aapt: No such file or directory
which is the same problem as in the CentOS (Can not run android/sdk/build-tools/23.0.2/aapt): A 32 bit library is missing.
Can someone tell me what would be the correct way to add the libraries?
EDIT
Since the interpreter, normally /lib/ld-linux.so.2
starts interpreting files, it needs to be replaced. If I manually extract all .so-files like described above, put them in lib/
and run
LD_LIBRARY_PATH=$(pwd)/libs libs/ld-linux.so.2 build-tools/23.0.3/aapt
the aapt-command is executed correctly. Unfortunately, this is not enough for building:
LD_LIBRARY_PATH=/nfs/user/do820mize/workspaces/dissworkspace/androidsdk/libs /nfs/user/do820mize/workspaces/dissworkspace/androidsdk/libs/ld-linux.so.2 ./gradlew --init-script ../init.gradle assemble
returns the ELF-error again, since the gradle-wrapper (and Java and so on) are 64 bit binaries.