I am trying to use ANTLR on Android, and I found this: ANTLR and Android
After downloading the AntlrJavaRuntime I am not sure of what to do, I am supposed to make this:
1. lunch the appropriate target
2. make AntlrJavaRuntime
3. verify that AntlrJavaRuntime.xml was placed in /system/etc/permissions and
4. AntlrJavaRuntime.jar was placed in /system/framework
5. after this, you can run a normal make
First of all, what does step 1 even means?
Secondly, when I try doing: make AntlrJavaRuntime I get the following error:
~/AntlrJavaRuntime$ make AntlrJavaRuntime
make: Nothing to be done for `AntlrJavaRuntime'.
It's very hard to find documentation about this, so any help is really appreciated (or a clear example of how to get ANTLR ready for an Android project).
This answer maybe a little late, but anyway...
I am the author for the Antlr Port. Those sources are meant to be used within the android source code. however, just including the sources into your andriod project should solve your problem.
I should have mentioned that the building instructions are only when adding Antlr to the Android OS source code.
-Earlence
Well, I just did a little test with a "plain" ANTLR version, and everything went just fine.
Here's what I did:
1 new Android project
Create a new project called
AndAbac
(Android-Abacus) with a package namedbk.andabac
and an activity calledAndAbac
.2 create a grammar
Create a grammar file called
Exp.g
(explanation here) anywhere on your system and paste the following in it:3 download ANTLR & generate lexer/parser
Download ANTLR here: http://www.antlr3.org/download/antlr-3.3-complete.jar and put it in the same directory as your
Exp.g
file. Generate a lexer and parser (explanation here) and copy the generated.java
files to the following folder in your Android project:src/bk/andabac
. Also put this ANTLR jar to the classpath of your Android project.4 change some project files
Paste the following in
res/layout/main.xml
:and the following in
src/bk/andabac/AndAbac.java
:5 test the app
Either run the project in an emulator, or create an APK file and install this on an Android device (I tested both, and both worked). You will see the following after pressing the eval button: