Some APIs in the Android SDK are not fully exposed to Delphi XE5 and XE6 Firemonkey (and AppMethod) by default. The Android SDK needed Object Pascal interface files created to make it easier to access those APIs. There are three different automated solutions available to make this happen. I went ahead and used Java2pas against the entire set of android.jar files for Android 7, Android 8, Android 10, Android 12, Android 14, Android 15, Android 16, Android 17, and Android 19. Java2pas automatically created 3,412 interface files for Android 19 which is Android 4.4 Kitkat. Depending on which Android version you want to target you should use the interface files from that version of Android. I took all of the generated interface files from all of the Android SDK versions and uploaded them to Github. There is everything from android.security.KeyChain to android.speech.tts.TextToSpeech to android.nfc.NfcAdapter to android.opengl.GLES30 to android.os.Vibrator to android.provider.ContactsContract and literally thousands of more interfaces. What is awesome about all of these interfaces is that you can access all of them without having to modify the classes.dex file which you would have to do if this was a third party JAR.
Head over and check out the full set of Android SDK Object Pascal interface files on Github.
Great work!
Awesome. Who are you, man? Thank you a LOT!
Facing a lot of circular references… Need to build a kind of common lib for that. Any other solution? Any way, great job!! 🙂
Yeah Java2pas doesn’t have a solution for that yet. You’ll have to combine the circular reference pas files manually for now.
If you encounter circular references, you have to merge the “called” files into ther “caller” pascal units and create forward declararations. Java doesn’t care if you use import *, Pascal is always single pass and doesn’t like that.
I have written a standalone tool which lists circular references for classes generated by java2pas which I eventually will either provide together with it or integrate. It will take a wildcard as parameter and resolve the circular references, merging uses, interface and consts.
Just this morning I learned that RAD Studio at the Professional includes the mobile development Add-On pack, which is extra if you buy Delphi XE6 unless you go up to the Architect level. I sometimes use C++ on work related projects, and I love the fact that when I call into C++ code (in a DLL) from Delphi code, I can single step right through the function call in the debugger and see what’s going on in the C code. I once read a book asserting that this is not possible, but the single back end compiler from Embarcadero enables it.
I cannot to resolve the circular problems. Can anybody help me?
Basically you have to combine the circular references into one unit. There isn’t an update for Java2pas yet that completely takes care of the issue.
I understand it. Thank you!
you mentioned the android.nfc.NfcAdapter, but to use it as reader you probarly have to include all files