The BeerExpert is a project created to include CLIPS to Android, encapsulating the knowledge elicited from a beer brewer.
The project is organized as follows:
- BeerExpert
- It is an application embedding an expert system specialized in beers and in brewing beers. It gives suggestions based on the user preference. It contains the rules and the facts (in the folder assets) necessary to make inference with forward chaining. The information about the beers are stored in a SQLite database.
- APK
- It's the folder containing the APK file for the installation of the application on your phone. To install it, just open this file on an Android device.
- ClipsAndroid
- It is an Android library which is intended to be used by other Android applications. To compile the project with Android Studio, it is necessary to compile the CLIPS module for Android first (see Compiling CLIPS for Android.).
To compile the app in Android Studio, it's necessary to compile CLIPS first (it should be already compiled anyway). Follow the following steps to compile the CLIPS module, written in C:
- Compiling CLIPS from Android Studio
- Open the SDK manager in Android Studio
- Go to the SDK tools section
- Check the boxes next to NDK, LLDB and C-make and apply the changes to download them clicking OK
- Link the C module (the folder ClipsAndroid) with Gradle in the project explorer pane (with right-click)
- Select the file Android.mk to be build with ndk-build
- Clean the environment and build the app
- Compiling CLIPS from command line
-
[*] Providing you have added it to your PATH.
The cleanest way to show messages from a native library in Android is by simply redirecting its output (see Redirecting stdout). The CLIPS' module is forced to show all its messages using Logcat (see Logcat from native code).
CLIPS may throw system exits. As a result, the Android process using CLIPS can unexpectedly crash without giving any useful information. To show CLIPS' original error messages, redirect NDK's standard output to LogCat using the following commands:
$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start
Sometimes the previous property does not work (I don't know why yet). Since messages can be directly logged on Logcat, we replaced the printf's with these Logcat's logs in the issue 2 .
To that end, we have done an utility macro. Common usage:
#include "logcat.h"
...
aprintf("This is an standard message\n");
CLIPS's source files remain licensed in the public domain.
The rest of the parts of this project will be licensed also as public domain unless the contrary is stated.
The original project was downloaded from CLIPS4Android project and modified for the development of an app at the University of Groningen (Netherlands).
The development was possible with the work done in the CLIPSJNI project. Besides, this project is supported or has been supported by the THOFU R&D project (project grant CEN-20101019).