Is it possible to build AOSP project (Gingerbread) in kubuntu12.04 (xubuntu)? - android

I work with older releases of Android (Gingerbread 2.3.4). To develop for these versions I use now Ubuntu 10.04. At the same time, I would like to use more recent version: 12.04 or maybe 12.10. It is written here:
Building on Ubuntu 12.04 is currently only experimentally supported
and is not guaranteed to work on branches other than master.
So here is my question, has anybody tried to build old versions of Android on Ubuntu 12.04? I do not like new unity interface so I also consider xfce or kde. That's why here is the second question, will I have any troubles with building if I change window system?

Yes, it is possible to build Gingerbread on Ubuntu 12.10.
Biggest problem is that Ubuntu 12.10 has newer gcc 4.7, which is very strict.
It is possible to fix it by patching Android source to be compliant with new gcc requirements. However, this can be difficult to do, especially when it involves patching older kernel sources.
You can bypass this by simply installing older gcc 4.4 (which is default version in Ubuntu 10.10).
sudo apt-get install gcc-4.4-multilib g++-4.4-multilib
After that, you need to make gcc 4.4 to be the default compiler for your Android compilation.
Easiest way is to simply symlink gcc, g++, cpp to point to older versions and add it to PATH:
mkdir ~/bin
cd ~/bin
ln -s /usr/bin/g++-4.4 g++
ln -s /usr/bin/gcc-4.4 gcc
ln -s /usr/bin/cpp-4.4 cpp
# you might want to add line below to ~/.bashrc:
export PATH=$HOME/bin:$PATH
Now, you need to have Java installed. Unlike newer Android 4, Gingerbread can be built using OpenJDK, so you should be able to simply
sudo apt-get install openjdk-6-jdk
to get working JDK.
Also see this thread.

Related

Android Device Monitor not opening in Ubuntu 17.10

When I open Android Device monitor, I am getting the following error:
An error has occurred. See the log file
/home/omkar/Android/Sdk/tools/lib/monitor-x86_64/configuration/1509852867579.log.
I have already tried:
Running Android studio with "sudo"/ root user permission.
Reinstalling Android SDK.
My configuration :
Android Studio 3.0
Android SDK API version 27.
Ubuntu 17.10 Gnome
I am attaching the pastebin link for the logs in the question.
Logs Link : https://pastebin.com/cje8fkgY
While Android Studio brings its own Java version with it, the (now mostly deprecated) Android Device Monitor (ADM) is dependent on the Java version installed on your machine. From other error reports around the web, it seems that ADM needs Java 8 (here, for example). This is also where our machines differ from each other. As I noted in a comment above, I am, too, on Ubuntu 17.10, Android Sdk 27 and Android Studio 3.0, however, I have Java 8 installed, and ADM runs fine.
Therefore I would suggest you to add Java 8 to your machine and make it the default version. On Ubuntu, you can do this like that:
sudo add-apt-repository ppa:webupd8team/java // only necessary if repository not yet added
sudo apt-get update // only necessary if repository not yet added
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
You need to set the default Java version. To do this follow below steps:
Run:
sudo update-java-alternatives --list
to list off all the Java installations on a machine by name and directory, and then run:
sudo update-java-alternatives --set [JDK/JRE name e.g. java-1.8.0-openjdk-amd64]
This worked perfectly for me.

How can mercurial be run on android?

This page documents running an old version (1.8.4) of mercurial but says
"(later versions need an unavaliable python module named grp)"
This is the way I did it (but am still interested to hear of alternative ways) using an Ubuntu 16.04 machine and a intel 64bit android emulator running on Windows 7, using mercurial 3.7.3
Using an Ubuntu system, follow these instructions for creating 2.7 version of python capable of running hg.
Copy python onto android device into an app files directory (so it can be executed)
on windows host
adb push python279.x86_64 /sdcard
adb -e shell
on android device
cd /data/user/0/$SOMEAPPDIR/files
cp -Rav /scard/python279.x86_64 .
make python excutable
chmod +x python279.x86_64/bin/python2.7
set some env vars need to make python run on android
export LD_LIBRARY_PATH=/data/user/0/$SOMEAPPDIR/files/python279.x86_64/lib
export LD_PRELOAD=libffi.so:libbz2.so
export PATH=$PATH:/data/user/0/$SOMEAPPDIR/files/python279.x86_64/bin
Python should now be able to be run with python2.7
Build mercurial on Ubuntu host.
download mercurial 3.7.3
uz mercurial-3.7.3.tar.gz
cd mercurial-3.7.3 && make all
HOME=$PWD/dist make install
Make minor modifications
cd dist/mercurial-3.7.3/dist/lib/python/mercurial
rm *.so
cp pure/*.py .
Edit posix.py and delete the "import grp" line.
copy mercurial onto android device
on windows host
adb push dist /sdcard
adb -e shell
on android device
cd /data/user/0/$SOMEAPPDIR/files
cp /sdcard/dist .
alias hg to make it easy to use
alias hg='python2.7 /data/user/0/$SOMEAPPDIR/files/dist/bin/hg'
Hg should now be possible to use on android device.
It's even possible to clone remote repos but I also had to pass the --insecure flag to bypass ssl errors.
The answer made on "Feb 15 '17" works fine however there is one fairly big drawback.
This answer address this drawback and is intended to be used in conjunction with the previous answer.
The problem
This procedure:
rm *.so
cp pure/*.py .
removes the native libraries and uses the python 'pure' implementation of these libraries instead. This causes major performance problem when working with large repositories, especially on slower android devices.
The solution
Cross compiling mercurial with android ndk, produces native libraries that can be used on android.
I've added some helper scripts to a mercurial 4.8.2 fork to make cross compiling easier.
Linux instructions:
Clone the repo
hg clone https://bitbucket.org/hindlemail/hg-stable-android/
update to 331892efe015
hg update -r 331892efe015
Set these for environment variables with appropriate values:
provide location of android NDK
ANDROID_NDK="$HOME/Android/android-ndk-r13b"
specify build arch - (armeabi, x86, x86_64, arm64)
ARCH="armeabi"
specify target android sdk verison
PLATFORM="android-22"
specify output of cross compiled python.
(see answer from Feb 15 '17" for more info )
PYTHONDIR="/usr/local/android/install/python279.arm22"
Run crosscompile.sh

"No such file or directory" trying to execute linux binary on Android device

I built a native linux ARM binary using the Android GCC toolchain (plain linux, no android or NDK).
I connected, from my PC, via adb shell, to a tablet running Android 4.
I "adb push"'ed that binary into /system/bin on that device, hoping I would get it to execute there. I marked it executable with chmod 777.
If I try to execute it, I would get "No such file or directory".
Further info:
The little program uses fc and fm libs. Since the ARM toolchain does not appear to have crt1, which, from an example I found, normally contains the startup code, we searched through files containing it in the android build, found crtbegin_dynamic and crtend_dynamic, but for _static equivalent, one of the pair was missing, so I did not pass -static to GCC. It was built with "-nostdlib".
What could be the problem(s)?
If you are working on a 64-bit platform like Ubuntu 64, then this tip may help you solve the issue. Just try to get the i386 32-bit compatibility libraries installed simply with
apt-get:
sudo apt-get install ia32-libs
It worked great for me. Let me know if you are stuck in same trouble.
For Ubuntu 13.10 or greater
As aditya said in the comments to this answer:
As of Ubuntu 13.10, one has to run this now:
sudo apt-get install lib32z1, you may need to get the C++ stdlibs too, with this: sudo apt-get install lib32ncurses5 lib32stdc++6
To amend aditya's comment above, you can also use the following for the C++ stdlibs in Ubuntu 13.10:
sudo apt-get install lib32ncurses5 libstdc++6:i386

Bash cannot find adb even though it's definitely there

I'm running ArchLinux, kernel 3.4.4, bash version 4.2.29. I downloaded the android sdk from here: http://developer.android.com/sdk/index.html
Once extracted I did, did ~/android-sdk-linux/tools/android and installed the SDK platform tools package.
From there I tried the following:
> ls -l ~/android-sdk-linux/platform-tools/adb
-rwxr-xr-x 1 mediocregopher mediocregopher 204436 Jun 28 13:20 /home/mediocregopher/android-sdk-linux/platform-tools/adb
> file ~/android-sdk-linux/platform-tools/adb
/home/mediocregopher/android-sdk-linux/platform-tools/adb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
> ~/android-sdk-linux/platform-tools/adb
bash: /home/mediocregopher/android-sdk-linux/platform-tools/adb: No such file or directory
Clearly the file is there and at the very least executable, why can't bash seem to find it? I've tried adding the platform-tools folder to my path as well as sudo and su-ing, but no matter what it seems like the file is not found. Does anyone know what could be happening?
You're running on a 64bit system and you do not have the 32bit compatibility libraries installed.
The error is actually coming from the fact that it can't find the 32bit ld.so.
If you're using ubuntu/debian, I think you just need to sudo apt-get install ia32-libs and it should work.
For 'modern' versions of Ubuntu (13.10 and higher), the accepted answer is not working anymore: They removed the '32 bit compability libraries' and instead you need to use multiarch packages that happily coexists next to each other. See What happened to the ia32-libs package? on AskUbuntu.
Instead you need to install the 32 bit version of libc:
sudo apt-get install libc6:i386
Next, I encounterd that a 32 bit version of libstdc++ is also required by adb:
sudo apt-get install libstdc++6:i386
Now adb should be working (again).
Android SDK on a 64-bit linux machine shows that some other libraries are required as well. I did not seem to require them as well, but might have had them installed already.

Eclipse on x64 Fedora

I have installed eclipse and android SDK on Fedora 17. In eclipse I got this error
/home/jakub/Android/android-sdk-linux/platform-tools/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
I tried install this packages: ncurses-libs.i686 libstdc++.i686 libgcc.i686, but always got that error
i got it working on 64bit CentOS using a stackexchange answer i cannot find at the moment. It basically involved appending .i686 to several package names, ie:
yum install libstdc++.i686
ia32-libs does not formally exist as an rpm. However, on my Ubuntu 10.04 box
dpkg --listfiles ia32-libs | wc
indicates there are 1456 files in ia32-libs to make 32bit stuff work on 64bit Debian based platforms. i certainly did not install 1456 .i686 packages. So just now, i entered
$ rpm -qa | grep i686
libX11-1.3-2.el6.i686
libstdc++-4.4.6-4.el6.i686
openssl-1.0.0-25.el6_3.1.i686
libXau-1.0.5-1.el6.i686
SDL-1.2.14-3.el6.i686
glibc-2.12-1.80.el6_3.7.i686
libgcc-4.4.6-4.el6.i686
libxcb-1.5-1.el6.i686
libXrandr-1.3.0-4.el6.i686
zlib-1.2.3-27.el6.i686
libselinux-2.0.94-5.3.el6.i686
openssl-devel-1.0.0-25.el6_3.1.i686
nss-softokn-freebl-3.12.9-11.el6.i686
ncurses-libs-5.7-3.20090208.el6.i686
krb5-libs-1.9-33.el6_3.3.i686
libXext-1.1-3.el6.i686
libcom_err-1.41.12-12.el6.i686
libXrender-0.9.5-1.el6.i686
keyutils-libs-1.4-4.el6.i686
When i find the original answer i used, i will post it back here.
did you used android in fedora before.?
System requirements
Operating Systems
Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)
Mac OS X 10.5.8 or later (x86 only)
Linux (tested on Ubuntu Linux, Lucid Lynx)
GNU C Library (glibc) 2.7 or later is required.
On Ubuntu Linux, version 8.04 or later is required.
64-bit distributions must be capable of running 32-bit applications.
link:
because SDK is 32bit
try to use: yum install ia32-libs

Categories

Resources