Jump to content
Sign in to follow this  
Alex Texera

Sdk version in AndroidManifest file and Rad Studio

Recommended Posts

Hello,

 

I have several questions about sdk version. My client have Android 11 but my current phone is Android 10 and can't test what is problem on Android 11 (App is installed but when try open automatically is close only one second see fire FMX logo).

 

I use 10.3.2  Rad Studio, when create blank FMX aplication in  AndroidManifest stay  minSdkVersion="19" and targetSdkVersion="28".

 

This configuration   minSdkVersion="19" and targetSdkVersion="28" is not compatible for Android 11 (use API 30) .  Am I right?

 

When try change targetSdkVersion="28"  to targetSdkVersion="30" and build apk on my phone (Android 10) app not working (App is installed but when try open automatically is close only one second see fire FMX logo)..

 

Is it possible somewhere in Rad Studio set targetSdkVersion ?  What is your default min and target sdk version?

 

Where I can see compile sdk version in rad studio?

 

Do you need anything change in sdk manager > path?   Image attached below!

 

 

Tnx all for help!

 

 

sdk.png

Edited by Alex Texera

Share this post


Link to post

Upgrading the SDK opens possibility for incompatibilities.

 

Applications with lower SDK version run in compatibility mode on newer versions of the OS. When you increase SDK version you are basically saying this application supports all new OS APIs. If your application (that includes RTL and FXM) does not support all new APIs it can crash or malfunction.

 

See: https://quality.embarcadero.com/browse/RSP-27218

 

This issue has been resolved in 10.4 Sydney and Android 11 is now officially supported by Delphi. I am not sure if there are any other issues.

Edited by Dalija Prasnikar
  • Thanks 1

Share this post


Link to post
40 minutes ago, Dalija Prasnikar said:

Upgrading the SDK opens possibility for incompatibilities.

 

Applications with lower SDK version run in compatibility mode on newer versions of the OS. When you increase SDK version you are basically saying this application supports all new OS APIs. If your application (that includes RTL and FXM) does not support all new APIs it can crash or malfunction.

 

See: https://quality.embarcadero.com/browse/RSP-27218

 

This issue has been resolved in 10.4 Sydney and Android 11 is now officially supported by Delphi. I am not sure if there are any other issues.

Tnx for answer, I don't have login credentials for your link.    Are you developing FMX application, what stay in your sdk path in rad studio (Android-28, 29, 30)?  

Share this post


Link to post
21 minutes ago, Alex Texera said:

Tnx for answer, I don't have login credentials for your link.    Are you developing FMX application, what stay in your sdk path in rad studio (Android-28, 29, 30)?  

I currently have API 29, but I am testing Delphi Android applications only on Android 7.0 device.

 

I am not actively developing on Android with Delphi. When I started Delphi for Android was not suitable for my use case and didn't have support for devices I needed, so I had to use Android Studio.

  • Like 1
  • Thanks 1

Share this post


Link to post

Hi,

 

if you're using storage ... Android 11 have upgraded security

 

in AndroidManifest.xml in section application add line

 

        android:requestLegacyExternalStorage="true"    

 

 

regards,

M

Edited by mausmb

Share this post


Link to post
23 hours ago, mausmb said:

        android:requestLegacyExternalStorage="true"    

Maybe thats not a complete solution either.

 

Quote
If your app targets Android 11

Set the preserveLegacyExternalStorage flag to true to preserve the legacy storage model so that your app can migrate a user's data when they upgrade to the new version of your app that targets Android 11.

 

Note: If you set preserveLegacyExternalStorage to true, the legacy storage model remains in effect only until the user uninstalls your app. If the user installs or reinstalls your app on a device that runs Android 11, then your app cannot opt out the scoped storage model, regardless of the value of preserveLegacyExternalStorage.

 

 

Edited by Rollo62

Share this post


Link to post

I'm create blank fmx app, in rad studio in sdk path set android-30, in android manifest change  target sdk to 30 but app again not working on android 11 devices.

 

 

PS.  preserveLegacyExternalStorage  I don't see this option in Uses Permissions!

Edited by Alex Texera

Share this post


Link to post

Hi,

 

1. You shouldn't put "targetSdkVersion" version in AndroidManifest file

2. You should upgrade to 10.4.2 (Automatic target version is 29)

3. My apps working with Android 11 (Pixel3, Pixel4,...) 

 

" android:requestLegacyExternalStorage="true" " it's only for specific purpose as @Rollo62 pointed out. (Migration storage files)

 

 AndroidManifest.template

 

<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="%package%"
        android:versionCode="%versionCode%"
        android:versionName="%versionName%"
        android:installLocation="%installLocation%">

    <!-- This is the platform API where NativeActivity was introduced. -->
    <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" />
<%uses-permission%>
    <uses-feature android:glEsVersion="0x00020000" android:required="True"/>
    <application android:persistent="%persistent%" 
        android:restoreAnyVersion="%restoreAnyVersion%" 
        android:label="%label%" 
        android:debuggable="%debuggable%" 
        android:largeHeap="%largeHeap%"
        android:requestLegacyExternalStorage="true"            
        android:icon="%icon%"
        android:theme="%theme%"
        android:hardwareAccelerated="%hardwareAccelerated%">

<%application-meta-data%>
        <%services%>
        <!-- Our activity is a subclass of the built-in NativeActivity framework class.
             This will take care of integrating with our NDK code. -->
        <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
                android:label="%activityLabel%"
                android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
                android:launchMode="singleTask">
            <!-- Tell NativeActivity the name of our .so -->
            <meta-data android:name="android.app.lib_name"
                android:value="%libNameValue%" />
            <intent-filter>  
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter> 
        </activity>
        <%activity%>
        <%receivers%>
    </application>
</manifest>
<!-- END_INCLUDE(manifest) -->
 

 

AndroidManifest.xml generated from AndroidManifest.template

 

<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="si.ros.RosNZ"
        android:versionCode="28"
        android:versionName="1.1.0"
        android:installLocation="auto">

    <!-- This is the platform API where NativeActivity was introduced. -->
    <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.NFC" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-feature android:glEsVersion="0x00020000" android:required="True"/>
    <application android:persistent="False" 
        android:restoreAnyVersion="False" 
        android:label="RosNZ" 
        android:debuggable="False" 
        android:largeHeap="False"
        android:requestLegacyExternalStorage="true"            
        android:icon="@drawable/ic_launcher"
        android:theme="@style/AppTheme"
        android:hardwareAccelerated="true">


        
        <!-- Our activity is a subclass of the built-in NativeActivity framework class.
             This will take care of integrating with our NDK code. -->
        <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity"
                android:label="RosNZ"
                android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
                android:launchMode="singleTask">
            <!-- Tell NativeActivity the name of our .so -->
            <meta-data android:name="android.app.lib_name"
                android:value="TESTXXAPP" />
            <intent-filter>  
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter> 
        </activity>
        
        <receiver android:name="com.embarcadero.rtl.notifications.NotificationAlarm" />

    </application>
</manifest>
<!-- END_INCLUDE(manifest) -->
 

 

 

 

 

Regards,

Marjan 

 

  • Thanks 1

Share this post


Link to post
11 minutes ago, mausmb said:

 

Marjan 

 

Tnx for answer, Is your sdk version 25.2.5 ?  Can you put here your settings screenshot from rad studio?

 

GL

 

 

sdk.png

Share this post


Link to post

Maybe additional info here, if that concerns someone using the All files access (MANAGE_EXTERNAL_STORAGE) permission

https://support.google.com/googleplay/android-developer/answer/9956427

 

Quote

For now, if you think All files access is needed for your app, it is recommended that you don’t update your target SDK level to Android 11 (API level 30) at this time.

If you target Android 10, consider using the requestLegacyExternalStorage flag.

 

Edited by Rollo62

Share this post


Link to post
Guest

if you want try update your Android SDK, you can! Just repect the limitation for each edition of RAD.

here my help 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×