Run the following commands:
sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
sudo apt update
sudo apt install ubuntu-make
Make sure the umake version is at least 16.05
umake --version
Install Android Studio
umake android
There will be a prompt for the installation path, probably ~/.local/share/umake/android/android-studio. Accept it.
Choose installation path: /home/user/.local/share/umake/android/android-studio
See How to install Android Studio on Ubuntu
Development is typically more effective on a real Android device than a virtual (i.e. emulated) device.
If you connect a device without setting it up for development it won't typically show up as a device available in Android Studio
Use the following steps to allow development of applications on a real Android device:As described under Ceda development on Linux, use the following steps to install the CEDA SDK, and the pyceda and pypizza python extension modules:
There is a Android CEDA SDK specifically tailored for building CEDA based applications that run on Android devices.
Currently only the arm64-v8a platform is supported
It is assumed the pizza example has been downloaded.
Run the build_pizza_library_android bash script to run Xcpp to translate the Xc++ files into straight C++:
cd ~/developer/pizza/Acme
./build_pizza_library_android
Download the tarball using this link: CedaAndroidExample-0.7.tar.gz (file size is 0.1 MB)
Uncompress the CedaAndroidExample-0.7.tar.gz file using the following commands:
mkdir ~/developer/CedaAndroidExample
cd ~/developer/CedaAndroidExample
tar -xvf ~/developer/CedaAndroidExample-0.7.tar.gz
cd ~/developer/CedaAndroidExample/app/src/main/
mkdir -p jniLibs/arm64-v8a
cp ~/developer/ceda-android/lib/arm64-v8a/Release/* jniLibs/arm64-v8a/
CEDA needs to be able to write a local database to external storage. See Saving Files on developer.android.com.
To write to the external storage, you must request the WRITE_EXTERNAL_STORAGE permission in your manifest file:
<manifest ...> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> ... </manifest>
A path to a CEDA database must be defined in a directory for which the Android application has permissions to read/write. For the above example a path of the form "/sdcard/temp/filename" has been used
CEDA needs to be able to open network sockets. See Connecting to the Network on developer.android.com
In order to perform network operations in your application, your manifest must include the following permissions:
<manifest ...> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> ... </manifest>
A JNI function needs to be written for initialisation purposes, that is called once by your Android application. This must call a function to register the CEDA reflected datatypes. This is mandatory for CEDA to work correctly
In the above example this involved the call to the following function:
extern "C" void Register_Project_Pizza();
It is a good idea for the JNI functions to use a try-catch block to catch exceptions thrown by the C++ code, to allow errors generated by CEDA to be displayed to help diagnose problems. I suggest these are logged so they appear in the Logcat window of Android Studio during development.
For core CEDA library developers here are the instructions for packaging the CEDA core libraries for targeting Android.