In the post, Android Fun, I described some of the issues I went through converting my first App to API30. I am almost done converting the next two Apps. While some of the issues were the same, a whole host of other issues and errors happened with these. Here is a recap of my progress so far.
As I commented in Embarcadero's public JIRA, RSP-35804, I had problems converting existing Android Apps. For those who do not have access, here is the text.
" I came here from RSP-35919
(Android 12 - Bluetooth LE discover devices - access to location). I
was updating a BTLE app from API 23 to API 30 for the Aug 2022 deadline.
I started with Delphi 11.1 and had the same issue. The APP would fail
during initialization. I backed up to 10.3.3 and API 23 and verified it
still worked. Then moved through the API levels one at a time, changing
to 10.4.2 when needed, then 11.0 and finally 11.1 and API 30. Made the
changes needed at each API level and compiler version. (Note: when the
permission types changed in 11.0, I created conditional compiler code so
I could easily go back and forth between 10.4.2 and 11.0). It now
works. What I changed that allowed it to work on 11.1 and API 30, I am
not sure. Tested on Android 7,8,11, and 12. Both 32 and 64bit. Again, I
am only doing BTLE device discovery, not location."
I have now converted my second App which was a little more complex than the first one. I had similar but different problems. At one point I had an error in FMX.Platform.Android, TPlatformAndroid.Create, on the line Activity.addListener(FActivityListener) which caused the App to hang with no Android error message, along with the location error RSP_35804 and a few others. I used the same basic process I describe above. What I am beginning to think is that the issue is a combination of the Android Manifest, library update (as described here) and carefully reviewing the project deployment page. Here is the closest process I have to a conversion checklist.
- At every API level change, delete both the Android Manifest Template and the Android Manifest. Start fresh. If you manually change this, make sure you save your changes elsewhere so you can update these later. Since I had not updated in a while, I had to start with 10.3.3, you start with where it worked last.
- Make sure you clean the project before Building. Then go look at the directory and see what is left. You might want to delete whatever is left, unless it is a file that you specifically need to be included. (See the next item and CLASSES.DEX)
- Carefully review the Project Deployment Options Page (PROJECT->Deployment) in all configurations (32 bit, 64 bit, DEBUG and RELEASE). This is especially true when going to version 11.x. The CLASSES.DEX file moved from the DEBUG/RELEASE directory to a <projectname>.classes sub-directory. Going back and forth between 11.x and 10.4.2 can orphan the CLASSES.DEX and I think this is causing issues. (What I dont like is you cannot delete anything on this page that the IDE inserted. So if you have been carrying this project since 10.0 or before there can be a lot of excess baggage.)
- When you get to version 11.x, it is imperative that you update the libraries as described in the link above for every project. This is not an IDE global update, but appears to be a project specific update.
The better approach may be to start the project fresh when moving to 11.x. I have not done this, so I do not know what fun things this idea can bring.