This repository is an example of how to call code written in Frege from an Android program. It's assumed that you will write your user interface in Java, and just write application logic in Frege. Calling Android APIs from Frege is trickier and is not discussed here.
You can get started using this repo as the basis for your own project
by running the change-package-name.pl
script in this directory.
Give it the package name you want to use, and the activity name you
want to use, and it will rename the code. For example:
./change-package-name.pl com.example.whatever WhateverActivity
The code in this repo that I (Patrick Pelletier) have written is in
the public domain / cc0. However, some of the files come from
the scaffolding generated by android project create
, and part of the
build.gradle
file comes from a post on the Frege mailing list.
This project uses Frege 3.23, so for that you would use the old way of calling Frege from Java. I haven't tried using Frege 3.24, but if you want to try that, you'd use the new way.
Also, note that this project requires API Level 21 or higher, because Frege needs ForkJoinPool, which Android only has in level 21 and up.
I was not able to get Proguard to work successfully, so everything in the Frege jar file (including the compiler) gets uploaded to the phone. This required using multidex, although it works fine.
Pull requests are welcome!