I'm using Embarcadero's Delphi 10.4 and trying to create an app deployed to an Amazon Fire which is using Android's 9 (API level 28) OS. No matter what I try, every time I try and run the project, I get an error reading "No resource identifier found for attribute 'requestLegacyExternalStorage' in package 'android'".
My Build.Gradle file is targeting the OS's API level. I did try setting both the compile and target SDK versions to 29 though to see if it made a difference.
...
compileSdkVersion 28
defaultConfig {
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
externalNativeBuild {
cmake.arguments '-DANDROID_TOOLCHAIN=clang',
'-DANDROID_STL=c++_static',
'-DANDROID_PLATFORM=android-22'
}
}
...
My AndroidManifest is targeting my API level but again I tried 29 as well. I've also tried setting the 'requestLegacyExternalStorage' attribute to true and false. If I delete the attribute from the manifest then it'll successfully compile but then the second the splash screen appears on my device, the connection crashes in my IDE with no errors reported and the splash screen stays on my device screen... I can set a breakpoint and see that the Application.Initialize never even executes.
<?xml version="1.0" encoding="utf-8"?>
<!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.embarcadero.WhsScanner"
android:versionCode="1"
android:versionName="1.0.0"
android:installLocation="auto">
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<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="WhsScanner"
android:debuggable="True"
android:largeHeap="False"
android:icon="@drawable/ic_launcher"
android:theme="@style/AppTheme"
android:hardwareAccelerated="true"
android:resizeableActivity="false"
android:requestLegacyExternalStorage="false">
<!-- 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="WhsScanner"
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="WhsScanner" />
<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) -->
The SDK elements I'm using are as follows... Should all be up to date.
and then, of course, I have all SDK properties pointing to the API level 28 configuration files.
I can't even create a blank application!! PLEASE HELP!
I fixed the same problem in this way:
Compile and Building...
(addition) you don't need to copy and modify, deply changing AndroidManifest.xml from Build folder. Modify AndroidManifest.template.xml in your source folder. compile and build your source. that's all. I think this process is more simple.