aapt: error while loading shared libraries: libc++.so - android

We have an error during build:
AAPT err(Facade for 1550528231): /usr/local/android-sdk/build-tools/23.0.3/aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory
We have two build-tools installed:
# ls -l /usr/local/android-sdk/build-tools/
total 8
drwxr-xr-x 4 root root 4096 Jul 22 11:43 23.0.1
drwxr-xr-x 4 root root 4096 Jul 22 11:50 23.0.3
23.0.3 - downloaded and unpacked manually.
Both have libc++.so:
# find /usr/local/android-sdk/build-tools/ -name 'libc++.so'
/usr/local/android-sdk/build-tools/23.0.3/lib/libc++.so
/usr/local/android-sdk/build-tools/23.0.1/lib/libc++.so
/usr/local/android-sdk/build-tools/23.0.1/lib/ added to $PATH and $LD_LIBRARY_PATH:
$ echo $PATH
/usr/local/maven-3.2.5/bin:/usr/local/gradle-1.5/bin:/usr/share/centrifydc/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/local/android-sdk/tools:/usr/local/android-sdk/platform-tools:/usr/local/android-sdk/build-tools/23.0.3/lib/:/opt/awscli/bin:/usr/local/sonar-runner/bin:/usr/local/android-sdk/build-tools/23.0.3
$ echo $LD_LIBRARY_PATH
/usr/local/android-sdk-23.0.2/build-tools/23.0.3/lib/l
What's wrong here?
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04

Related

Android SDK - aapt: error while loading shared libraries: libc++.so

I downloaded the sdk-tools linux-3859397.zip and extract it to /opt/android (which is my ANDROID_HOME)
So, when I launch aapt it fail to load the libc++ shared library
$ /opt/android/build-tools/27.0.3/aapt
/opt/android/build-tools/27.0.3/aapt: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory
But the libc++ exists, as example the ldd tools has found it !
$ ldd /opt/android/build-tools/27.0.3/aapt
linux-vdso.so.1 (0x00007ffdd66b3000)
libc++.so => /opt/android/build-tools/27.0.3/lib64/libc++.so (0x00007fc511580000)
librt.so.1 => /usr/lib64/librt.so.1 (0x00007fc511378000)
libdl.so.2 => /usr/lib64/libdl.so.2 (0x00007fc511170000)
libpthread.so.0 => /usr/lib64/libpthread.so.0 (0x00007fc510f50000)
libz.so.1 => /usr/lib64/libz.so.1 (0x00007fc510d38000)
libm.so.6 => /usr/lib64/libm.so.6 (0x00007fc5109e0000)
libgcc_s.so.1 => /usr/lib64/libgcc_s.so.1 (0x00007fc5107c8000)
libc.so.6 => /usr/lib64/libc.so.6 (0x00007fc5103e0000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc511698000)
$ file /opt/android/build-tools/27.0.3/lib64/libc++.so
/opt/android/build-tools/27.0.3/lib64/libc++.so: setgid ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
I tried to install libstdc++-devel both in 32bit and 64 bits but that do not solve this issue
Thanks for your help
Note: same problem with aapt2
[Solved]
After copying libc++.so file to /lib/. Issue resolved.
sravan#host3933:/lib$ ls -al |grep libc++
-rwxr-xr-x 1 root root 5584312 Aug 20 17:41 libc++.so
sravan#host3933:/lib$ aapt -help
ERROR: Unknown command '-help'
Android Asset Packaging Tool
Usage:
aapt l[ist] [-v] [-a] file.{zip,jar,apk}
List contents of Zip-compatible archive.

Android CI using Bitbucket Pipelines and Docker

I am trying to set up Continuous Integration (CI) in Bitbucket Pipelines for Android.
I have created a sample blank activity using Android Studio 2.1.1.
With Pipelines I'm using the uber/android-build-environment Docker container which creates the environment nicely. Here is my bitbucket-pipelines.yml
image: uber/android-build-environment:latest
pipelines:
default:
- step:
script:
- echo y | android update sdk --filter "extra-android-m2repository" --no-ui -a # Grab the Android Support Repo which isn't included in the container
- ./gradlew assembleDebug
Some changes are needed since uber/android-build-environment is expecting to be run like so:
docker run -i -v $PWD:/project -t uber/android-build-environment /bin/bash /project/ci/build.sh
For example, the source is not copied to the volume /project but instead Pipelines copies the contents of the Bitbucket repo to the working directory of the container at:
/opt/atlassian/bitbucketci/agent/build
And when ./gradlew assembleDebug is run I get the following error:
...
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type TaskArtifactStateCacheAccess using TaskExecutionServices.createCacheAccess().
> Failed to create parent directory '/opt/atlassian/bitbucketci/agent/build/.gradle' when creating directory '/opt/atlassian/bitbucketci/agent/build/.gradle/2.10/taskArtifacts'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 56.449 secs
Running ls -al in the working directory gives:
ls -al
total 52
drwxr-xr-x 5 root root 4096 May 31 22:33 .
drwxr-xr-x 3 root root 4096 May 31 22:43 ..
drwxr-xr-x 3 root root 4096 May 31 22:33 app
-rw-r--r-- 1 root root 462 May 31 22:33 bitbucket-pipelines.yml
-rw-r--r-- 1 root root 498 May 31 22:33 build.gradle
drwxr-xr-x 8 root root 4096 May 31 22:33 .git
-rw-r--r-- 1 root root 387 May 31 22:33 .gitignore
drwxr-xr-x 3 root root 4096 May 31 22:33 gradle
-rw-r--r-- 1 root root 855 May 31 22:33 gradle.properties
-rwxr-xr-x 1 root root 4971 May 31 22:33 gradlew
-rw-r--r-- 1 root root 2314 May 31 22:33 gradlew.bat
-rw-r--r-- 1 root root 15 May 31 22:33 settings.gradle
It's a bug in their system , I report it(issue url, it's quite long) to them and they have fixed it (fix url).I have tested on my project and it successfully build.Try to build your project now and good luck.
It looks like uber/android-build-environment is not supported anymore.
I ended up using javiersantos/android-ci instead which works perfectly from scratch.
Just add the following content to bitbucket-pipeline.yml:
image: javiersantos/android-ci:27.0.3
pipelines:
default:
- step:
script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- chmod +x ./gradlew
- ./gradlew assembleDebug
Could you symlink your project from /opt/atlassian/bitbucketci/agent/build to /project from within the container? ln -s /opt/atlassian/bitbucketci/agent/build /project is the command you'll need.
or alternatively copy the files to the new path?
I have no experience with android development, so YMMV :)

zipalign: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory

I am trying to build android app. When I run the zip align tool to optimize the APK, I get this error message:
zipalign: error while loading shared libraries: libc++.so: cannot open shared object file: No such file or directory
I tried to install libc++
sudo aptitude install libc++
it says: Couldn't find package "libc+".
Snapshot of my terminal
If your system is 64-bits, there should be a folder lib64 on the path of
[android-path]/build-tools/[version]/
The files in lib64 are
[ec2-user 25.0.2]$ ll lib64/
total 51628
-rwxrwxrwx 1 ec2-user ec2-user 30712616 Dec 23 07:22 libLLVM.so
-rwxrwxrwx 1 ec2-user ec2-user 482522 Dec 23 07:22 libbcc.so
-rwxrwxrwx 1 ec2-user ec2-user 433914 Dec 23 07:22 libbcinfo.so
-rwxrwxrwx 1 ec2-user ec2-user 1211614 Dec 23 07:22 libc++.so
-rwxrwxrwx 1 ec2-user ec2-user 20019608 Dec 23 07:22 libclang.so
Just copy the folder lib64 and zipalign program together to the destination path, and you can run the zipalign correctly. It worked for me. I guess the zipalign has a dependency on the files in lib64 folder.
I met the same problems and google it. You can try the following suggestions:
If you are in 64-bit environment, try: sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev.
Update the latest android sdk tools and do not move the zipalign binary to any other folder. It solve my problem.
I had the exact same problem and it was probably because I moved the zipalign binary from <android-path>/build-tools/23.0.3 to <android-path>/tools.
The solution is to add the build-tools/23.0.3 dir to your path:
export PATH=${PATH}:<android-path>/build-tools/23.0.3

Gradle Error 2 in Android project even file exists

I've generated android project with gradle support in IntelliJ. I have arch linux, on my friend's computer who has Windows everything is ok. On my computer I cannot build project, I get following error:
Error:Gradle: Execution failed for task ':app:mergeDebugResources'.
/home/hubert/IdeaProjects/AGHacks/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/drawable-xhdpi/abc_list_selector_disabled_holo_light.9.png: Error: Cannot run program "/home/hubert/bin/android-sdk/android-sdk-linux/build-tools/21.0.1/aapt": error=2, No such file or directory
And both file exists:
➜ IdeaProjects ls -al /home/hubert/IdeaProjects/AGHacks/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/drawable-xhdpi/abc_list_selector_disabled_holo_light.9.png
-rw-r--r-- 1 hubert hubert 188 Oct 22 22:51 /home/hubert/IdeaProjects/AGHacks/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/drawable-xhdpi/abc_list_selector_disabled_holo_light.9.png
➜ IdeaProjects ls -al /home/hubert/bin/android-sdk/android-sdk-linux/build-tools/21.0.1/aapt
-rwxrwxrwx 1 hubert hubert 1248409 Oct 21 21:29 /home/hubert/bin/android-sdk/android-sdk-linux/build-tools/21.0.1/aapt`
What am I doing wrong?
I needed to install 32bit version of libc++ and other applications.

Unable to locate tools.jar Fedora

I'm trying to compile my python game to run on android using PGS4A and I'm getting this error
Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-1.7.0-openjdk- 1.7.0.60-2.4.7.0.fc20.x86_64/lib/tools.jar
There are a bunch of solutions for this on Windows but I can't find one for fedora.
I have the /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.x86_64/ but nothing else
Assuming you are using the Java that comes packaged with Fedora (some version of OpenJDK) you probably need to install the appropriate -devel package.
Here's an example of what you would do on my Fedora 20 workstation:
$ rpm -qa|grep openjdk
java-1.7.0-openjdk-headless-1.7.0.60-2.4.7.0.fc20.x86_64
java-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.x86_64
$ sudo yum install java-1.7.0-openjdk-devel
...
The first command tells me what Java I'm using (1.7.0, since 1.8.0 is another option) and the second command asks it to install the development libraries, which includes tools.jar, among other things.
But I should add that my /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.7.0.fc20.x86_64 directory does contain a few things:
-r--r--r--. 1 root root 172252 Apr 16 02:58 THIRD_PARTY_README
-r--r--r--. 1 root root 19263 Apr 16 02:58 LICENSE
-r--r--r--. 1 root root 1503 Apr 16 02:58 ASSEMBLY_EXCEPTION
drwxr-xr-x. 3 root root 4096 Apr 20 19:09 jre-abrt
drwxr-xr-x. 4 root root 4096 Apr 20 19:09 jre

Categories

Resources