Android Studio can't find aapt in M preview - android

You have the M preview channel build tools installed (at time of writing, rev 23rc1) and you get an error something like this:
Error:android-apt-compiler:
Cannot run program ".../sdk/build-tools/23.0.0_rc1/aapt": error=2, No such file or directory

The build-tools binaries have moved (again)! You find them now under the bin directory.
$ ls build-tools/23.0.0_rc1/bin/
aapt arm-linux-androideabi-ld dexdump llvm-rs-cc split-select
aidl bcc_compat i686-linux-android-ld mipsel-linux-android-ld zipalign
So as a temporary fix, symlink them.
cd $ANDROID_HOME/build-tools/23.0.0_rc1/
ln -s bin/* ./

As you say the build-tools binaries have moved. So, a temporary fix is open the SDK Manager and remove the Tools of Preview Channel 23rc1 and make the 22.x version as default. Later Rebuild your project and done.
I hope this is useful.

Related

Android SDK on Alpine - adb No such file or directory

I'm trying to build an Alpine image containing the Android SDK - specifically, the platform-tools package.
My Dockerfile does the following:
Installs Java and sets JAVA_HOME (needed for Android).
Downloads the Android SDK tools from Google.
Unzips the package.
Sets ANDROID_HOME. Also sets PATH so the sdkmanager executable can be used.
Installs platform-tools using sdkmanager.
Adds platform-tools to PATH.
platform-tools contains an executable named adb, but for some reason it cannot be seen. Running adb returns:
bash: /android-sdk/platform-tools/adb: No such file or directory
Here is my Dockerfile:
FROM alpine:latest
# Install bash and java
RUN apk update
RUN apk add bash openjdk8
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
ENV PATH="$PATH:$JAVA_HOME/bin"
# Download Android SDK and set PATH
RUN mkdir /android-sdk
RUN wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && unzip *.zip -d /android-sdk && rm *.zip
ENV ANDROID_HOME="/android-sdk"
ENV PATH="$PATH:$ANDROID_HOME/tools/bin"
# Install platform-tools
RUN yes | sdkmanager "platform-tools"
ENV PATH="$PATH:$ANDROID_HOME/platform-tools"
RUN adb version # throws error: adb not found
I've looked at this question but the problem should be fixed with platform-tools v24.0 and higher.
Alpine uses musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements.
adb is compiled with glibc, so it won't be able to run in Alpine, which usually results in the error: No such file or directory.
You can verify that a file is compiled with glibc by running file <path to file> | grep "interpreter /lib64/ld-linux-x86-64.so.2".
This may help, although the Gradle daemon randomly crashes for me on Alpine Linux when using the compatibility layer.
gcompat is the go-to compatibility layer for Alpine users.
apk add gcompat
After that you run your binaries as normal.
Source: https://wiki.alpinelinux.org/wiki/Running_glibc_programs
You can install android-tools like so:
RUN apk add \
android-tools \
--repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
The key is to set the --repository as shown, as it's only in the edge testing repo.
I don't think it includes the whole SDK, so may need to download and unzip as well for other tools. I don't know if this will handle everything you want, but adb prints a help document at least.

Aidl not found,but it already exists

if i type in buildozer -v android release.and not in root.
Check that aidl can be executed
build-tools folder not found /home/m/.buildozer/android/platform/android-sdk-20/build-tools
Search for Aidl
Aidl not found, please install it.
but if i type in aidl
enter image description here
I have been having this error for a long time and multiple instances, even after trying to reinstall Aidl, reinstall buildozer, and deleting .buildozer project file.
Problem
This was caused by installation of wrong/outdated/mixed android-sdk build tools at;
~/.buildozer/android/platform/android-sdk/build-tools
Note:
Buildozer can only build without Aidl error if only the latest/correct android-sdk build-tools are installed.
Solution
Navigate to android-sdk build-tools path as shown below;
cd ~/.buildozer/android/platform/android-sdk/build-tools
Check the latest build tool you have, type;
ls
You should see a list of folders with names 29.0.0, 29.0.2, or any other folders.... this can be different. Note the latest version, eg (from example above is 29.0.2)
If this folder is empty proceed.
Type;
sudo rm -Rf *
Then run the following command;
cd ~
On the command below, replace "build-tools;29.0.0" version flag with your latest version (Noted above from ls command). eg ("build-tools;29.0.0" to "build-tools;29.0.2"). Use the command as it is if the build-tools folder was empty.
Hit enter to download.
~/.buildozer/android/platform/android-sdk/tools/bin/sdkmanager "build-tools;29.0.0"
Navigate to your Buildozer build project folder, run;
buildozer android debug
I hope this will help you solve the problem.

An error while building a game with PGS4A

I making a small game in python with pygame.
I wanted to make the game available for android.
Hopefully, there was PGS4A for this
After doing the configuration I had to build it.
So I just typed the command:
python android.py build ~/project/programming/python/gameEngine release install
And I ended up with this error:
BUILD FAILED
/home/turquoisepotato/project/programming/python/pgs4a-0.9.6/android-sdk/tools/ant/build.xml:570: The following error occurred while executing this line:
/home/turquoisepotato/project/programming/python/pgs4a-0.9.6/android-sdk/tools/ant/build.xml:622: The following error occurred while executing this line:
/home/turquoisepotato/project/programming/python/pgs4a-0.9.6/android-sdk/tools/ant/build.xml:658: Execute failed: java.io.IOException: Cannot run program "/home/turquoisepotato/project/programming/python/pgs4a-0.9.6/android-sdk/platform-tools/aapt" (in directory "/home/turquoisepotato/project/programming/python/pgs4a-0.9.6/android-sdk/extras/google/play_licensing/library"): error=2, No such file or directory
What do I do with this. I'm lost.
I'm using crunch bang linux 11.
You're probably using a 64-bit OS, while the binaries are compiled against 32-bit libraries.
I'm not familiar with CrunchBang's repositories, but you can probably try
sudo apt-get install libc6:i386 libstdc++6:i386 zlib1g:i386 lib32ncurses5
and then run the installer again.
For some reason, this is a common problem that usually occurs on Windows with pgs4a 0.9.6.
Take a look at this.
To make sure that the directory structure of the unzipped file is the same as the screenshot.
You do not have a full android-sdk installed. You need the missing files that the error refers to. You can either roll-back to pgs4a 0.9.4, which doesn't use those licensing files or reinstall android-sdk
craig#ubuntu-desktop:~/Documents/python/pgs4a-0.9.6$ cd android-sdk/
craig#ubuntu-desktop:~/Documents/python/pgs4a-0.9.6/android-sdk$ ls
add-ons extras platforms platform-tools SDK Readme.txt temp tools
craig#ubuntu-desktop:~/Documents/python/pgs4a-0.9.6/android-sdk$ cd extras/
craig#ubuntu-desktop:~/Documents/python/pgs4a-0.9.6/android-sdk/extras$ ls
google
craig#ubuntu-desktop:~/Documents/python/pgs4a-0.9.6/android-sdk/extras$ cd google/
craig#ubuntu-desktop:~/Documents/python/pgs4a-0.9.6/android-sdk/extras/google$ ls
play_apk_expansion play_licensing
craig#ubuntu-desktop:~/Documents/python/pgs4a-0.9.6/android-sdk/extras/google$ cd play_licensing/
craig#ubuntu-desktop:~/Documents/python/pgs4a-0.9.6/android-sdk/extras/google/play_licensing$ ls
library LICENSE.txt README.txt sample source.properties test
craig#ubuntu-desktop:~/Documents/python/pgs4a-0.9.6/android-sdk/extras/google/play_licensing$
This link may help.
http://discussion.pychildren.org/t/windows-installation/10
To fix it go to this site http://ady.my/viewer/ and, in the section build, download the most recent version of build-tools. Extract the files 'aapt' and 'dx' and the directory 'lib' and move these all for the especified folder on the terminal /home/turquoisepotato/project/programming/python/pgs4a-0.9.6/android-sdk/platform-tools.
The code will be similar with this below:
mv aapt dx lib /home/turquoisepotato/project/programming/python/pgs4a-0.9.6/android-sdk/platform-tools
But the PGS4A is obselete. I suggest for you, use the Python for Android, that you find in this link: http://python-for-android.readthedocs.org/en/latest/

Android Hello-World compile error: Intellij cannot find aapt

I'm trying to get set up with an Android development environment using IntelliJ in Ubuntu 12.04. I create an Android Application Module, but when I try to build, I get the following error:
android-apt-compiler: Cannot run program "/home/jon/Programs/android-sdk-linux/platform-tools/aapt": java.io.IOException: error=2, No such file or directory
Several hours of scouring the internet hasn't helped.
By the way, I ran locate aapt in the terminal and found that aapt is located at /home/jon/Programs/android-sdk-linux/build-tools/17.0.0/aapt
It appears that the latest update to the r22 SDK release moved aapt and the lib jar from the platform-tools to the build-tools directory. While we wait for JetBrains to release an update, here's a quick fix using a couple of symbolic links:
From your AndroidSDK/platform-tools directory, run the following:
ln -s ../build-tools/17.0.0/aapt aapt
ln -s ../build-tools/17.0.0/lib lib
...and IntelliJ should be able to compile as normal.
update your IntelliJ to 12.1.4 by using beta releases as the update channel
In Windows it is enough to copy only aapt.exe, lib\dx.jar and dx.bat
from build-tools\android-4.2.2
to
platform-tools
The same problem occurred for me with android-studio. But, this probably applies to the IntelliJ IDE as well.
When checking the file location I saw, however, that aapt was in the expected location.
In my case the issue was that I was running a 64-bit Ubuntu linux system which cannot execute the 32-bit aapt executable.
Installing 32-bit compatibility libraries solved this issue in my case: sudo apt-get install ia32-libs
i solve it with this to line commands
ln -s ~/Programs/android-sdk-linux/build-tools/17.0.0/aapt ~/Programs/android-sdk-linux/platform-tools/aapt
ln -s ~/Programs/android-sdk-linux/build-tools/17.0.0/lib ~/Programs/android-sdk-linux/platform-tools/lib
I also noticed it.
ADT has been updated and they added this new build-tools where they moved everything.
Intellijidea is not updating paths so it's searching aapt in the old path.
I don't know how to solve it, so let me know if you find a solution...
UPDATE:
I think that you have only 2 options:
1) Use Android Build studio: http://developer.android.com/sdk/installing/studio.html
2) Copy (this is dirty but works) all content from build-tools/17.0.0/ to platform-tools/ and it will build
To complain to Jetbrains, go here: http://youtrack.jetbrains.com/issue/IDEA-107311
I reckon more votes will be a faster fix.
Thanks for the tip! On a mac running the Android 4.2.2 SDK, this worked great. You'll just need to update your paths accordingly. E.g.
ln -s ../build-tools/android-4.2.2/lib lib
ln -s ../build-tools/android-4.2.2/aapt aapt
I ran into this issue but with android-maven-plugin
and as a variant of your item #2 rather than copying the file(s) I simply created a symbolic/soft link for aapt
cd platform-tools
ln -s ../build-tools/17.0.0/aapt ./
This approach seemed to get all my builds functioning again.
Clone the android-maven-plugin on GitHub and install it in your repo
git clone https://github.com/jayway/maven-android-plugin.git
cd .../maven-android-plugin/
mvn clean install
Then update your pom to use version 3.5.4-SNAPSHOT of the plugin.
Everything should work properly !
I ran these three commands and my problem was resolved
mklink "%ANDROID_HOME%\platform-tools\aapt.exe" "%ANDROID_HOME%\build-tools\17.0.0\aapt.exe"
mklink /D "%ANDROID_HOME%\platform-tools\lib" "%ANDROID_HOME%\build-tools\17.0.0\lib"
mklink "%ANDROID_HOME%\platforms\android-17\tools" "%ANDROID_HOME%\build-tools\17.0.0\aidl.exe"
If you haven't set ANDROID_HOME Environmental variable the replace %ANDROID_HOME% with the path to your android SDK e.g. C:\Android\android-sdk
On Mac OS you need to
$ cd platform-tools
$ ln -s ../build-tools/android-4.2.2/aapt aapt
$ ln -s ../build-tools/android-4.2.2/lib lib
Goodlife once again.
Just incase of such an error clean project and you are good to go.

Error Running Android Project in Intellij IDEA

When I run my android project in Intellij IDEA using an AVD I get this error
android-apt-compiler: Cannot run program "/Users/myAccount/Documents/android-sdk-macosx/platform-tools/aapt": error=2, No such file or directory
Can anyone help? Thanks in advance!
Yeah according to Simon in
Android Hello-World compile error: Intellij cannot find aapt
"It appears that the latest update to the r22 SDK release moved aapt and the lib jar from the platform-tools to the build-tools directory. While we wait for JetBrains to release an update, here's a quick fix using a couple of symbolic links for Unix users:
From your AndroidSDK/platform-tools directory, run the following:
ln -s ../build-tools/17.0.0/aapt aapt
ln -s ../build-tools/17.0.0/lib lib
...and IntelliJ should be able to compile as normal.
"
Unfortunately copying is the easier way around this on windows...
unless you use something like
mklink /H C:\Users\Tom\androidsdk\build-tools\17.0.0\aapt.exe C:\Users\Tom\androidsdk\platform-tools\aapt.exe
in the command prompt to attempt to make a hard link window's style of the file to your platform tools folder.
caveat I haven't tried this though...
I solve this problem on WIn by copy all files from android-sdk/build-tools/17.0.0 to platform-tools folder.
i was successfully resolving on mac 10.8
copied only aapt and lib\dx.jar and dx
from build-tools/18.0.1
to
platform-tools
i copied only aapt.exe and lib\dx.jar
from build-tools\android-4.2.2
to
platform-tools

Categories

Resources