Android 6 Marshmallow with Delphi XE8 - android

Is it possible to create an app for Android 6 using Delphi XE8 instead of Delphi 10?
Now apps seem to crash on Android 6, but Delphi 10 apps seem to crash on older android versions.
I have multiple Android SDK installed from 19(Android 4.4) till 23(6.0)
I also have the newest android NDK(r10e) and the newest Java JDK.
The crashes seem to be very random. Can't yet say why it crashes exactly. I'll try to find out more!
Update:
It seems to be a device specific problem. If I run Delphi 10 app on emulators with android 4.2/6.0 the app doesn't crash. Also on my samsung galaxy tab with android 4.2 it doesn't crash. Only my sony xperia with android 5.1 crashes.
Update:
My app seems to crash becore I call TCloseAction.caFree in the FormClose event of my 2th form

I found out what the problem was for older android versions with my Delphi 10 version of the project.
Through commenting out code I found out that the TCloseAction.caFree crashes the app in the formclose event. I can't remove this otherwise the form memory doesn't get freed. I tried multiple methods but only this totaly frees all the memory of a form in a Firemonkey multi device project.
After finding this out I found that it crashes when I add a TVertScrollBox to a TTabItem. On my Form I have multiple tabs. And on one of them I have a Listbox that I fill runtime with items and below that a memo. In order to use this memo correctly I added a TVertScrollBox so when the keyboard is shown the keyboard doesn't hide the memo. When I added the VertScrollBox in the designer my listbox doesn't draw the items correctly, so that's why I add it runtime. But this causes the crash on older android versions. Apparently it doesn't like to get freed in the onClose event for some reason.
So for the final solution i'm left with putting the memo in the top of the TTabItem so it never gets hidden behind the keyboard and removing the TVertscrollbox from designer/runtime. Now my ListBoxItems get drawn correctly and my app doesn't crash on older android versions anymore.

Related

Why my app crash on some devices and change layout while in other devices even with diffrent sizes it work perfectly

Hi im new to android dev i started from 1 months ago
Well i created simple calculating application
I configured layout so it looks stable and in preview in some screen sizes it was as i expected
When i run the app it workks perfectly ln some devices i tried android 11 5 and 7
But in some other devices android 10,9,8,5 some buttons get bigger... and when i click a button to show an alerte dialog it crasheess
Well in other devices the alerte dialog show and the app works perfectly without any problem please help
well the problem is that you wrote your program for android 11 and that is why it is shown and performs differently in older versions of android if you wish to make it work the same on all devices then you should choose an older SDK version preferably one that is compatible with version 5; But if you do so you might not be able to use some of the new libraries or packages that you used for android 11.
Make sure the version you are applying on other devices is supported. If you are still experiencing crashing, please share the error code with us.

How to solve massive rendering problems in Android development

I'm currently working with Xamarin for developing an android app. The structure of the app is really simple yet but a big problem appeared concerning the rendering of my main page. First, it's important to know that I'm supposed to develop for target API 23 so Android 6.0.
And every time I test my application on my Android 6.0 device via USB-debugging the design is totally messed up with my only (!) button duplicated many times and the textViews mixed up over the screen (As shown in the picture link below).
Even though I am new to Xamarin and Android (and C#) I have my settings (as I think) in perfect order. The minimum API level is 21, the target SDK version 23 (Android 6.0), my device runs version 6.0.1, the target compiling framework in properties is set to 6.0, the manifest is set up as I mentioned before and even my "Designer" window with the layouts .axml is set to v23.
I really don't know what to try next, because I want to start coding further. Would be nice if sb could help me out with that.
I have already tested the code of the app on a different API level (26 I think) and it worked perfectly fine with my Galaxy S9 in Debugger mode. Everything looked like it was designed in first place.
I also tried different AppThemes in Visual Studio but not one of the 7-8 I tried worked in any way different except for the colors.
The android app does only switch when clicking the button, texthttps://imgur.com/i0xChVniew 2 into the current date and time. I'm really sure, that my code is not the problem.
Picture: How it should look (In Xamarin)
Picture: How it looks on the phone

Delphi Android preventing/dealing with multiview mode

today I tested some app I'm developing with Berlin Upd. 2 on a Sony Z4 tablet with Android 7.
If I press the right Android navigation button a bit longer the device splits the screen 2 two areas and thus shows two apps simultaneously. Seems to be a feature of Android 7+.
Unfortunately my app doesn't like this and is being terminated or terminates itself.
I didn't find any setting on this Sony device to disable the split screen button function.
I found some Android Manifest setting here:
How can I disable multiwindow mode for an Activity in Android N+
But every time I try to add this to the manifest template either for the entire app or for the activity (FMX apps only have one activity) and press F9 to test it on a device (in this case a Nexus 4 to ensure the setting doesn't
have negative effects on older versions) I get a "pa client exited with code 1" failure. When I remove the line from
the manifest template and press F9 everything works as it did before.
Any hints/advice?
I already searched for an app to disable the feature on the Z4, but we only found one for Galaxy S7 which had no effect on the Z4.
The solution is (and the Android documentation doesn't clearly state this requirement for somebody not using Google's preferred language/toolset) to download SDK 24 and Build Tools 24.x in SDK manager. In Delphi Tools/SDK one needs to point to the android-24 folder instead of the android-22 one and then adding this attribute to the node no longer leads to build problems in Delphi and the app cannot be crashed by somebody trying to enter split screen mode.

App crashes on Kindle Fire but not on Nexus 5. Both run 4.2.2 and SDK 17. What is the difference?

I working on my first Android app (published on iOS and Windows Phone before). When testing the app on a Nexu 5 eveything works fine but on a Kindle Fire the app crashes:
java.lang.IllegalStateException: Cannot add header view to list -- setAdapter has already been called.
This is NOT about the exception itself. I could easily solve the problem by simple using listView.addHeaderView(...) before using listView.setAdapter(...). Not a big deal, but why does the same code runs without any problem on one device but crashes on the other?
I would understand the problem if the devices would use different Android/SDK versions but this is not the case. Both devices run Android 4.2.2 with SDK Level 17...
I would understand the problem if it would be related to something close to the hardware or some vendor specific system calls, but this not the case. It is just about setting up a ListView...
So, what is the difference?
Of course I have only a limited set of test devices. How can I be sure that the app will work on all devices that are running a supported SDK Level?
EDIT:
Of course one device is a phone and the other a tablet. To app uses different layouts for large screens at some places but problem also shows up in Activities/Fragments that have the same layout on both devices. Additionally no separated code for large devices is used. Using the same code and the same layout on both devices leads to a crash on the Kindle but runs on the Nexus...

Android 2.2 have scrolling issues with phonegap app?

I have a phone gap app.
When I test it out on 2.2 froyo, (on actual phone and in AVD) it refuses to scroll.
I've tested it out on 2.3.3 and it works perfectly. Are there issues with scrolling in the 2.2 version?
If so, is there a workaround to this?
Some PhoneGap examples include the following line in initialization code:
document.addEventListener("touchmove", preventBehavior, false);
This will disable scrolling on some devices. If your app includes it, try deleting (or commenting) it.

Categories

Resources