Android Question B4A application android:requestLegacyExternalStorage="true" not work

cambol

Active Member
Licensed User
Device target version level 29

If I used android:requestLegacyExternalStorage="true" , app will not start installing to device .

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>
<application android:requestLegacyExternalStorage="true"  >
</application>    
<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="29" />
)
 

DonManfred

Expert
Licensed User
Longtime User
To use external Storage you need to define the Permission with AddPermission(...) and you need to use Runtimepermissions to get this workung

uses-permission was used for older SDKs. I guess it is a Mistake to change the android:maxSdkVersion to 29
 
Upvote 0

cambol

Active Member
Licensed User
After modify , It still can not installing

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="29"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>
<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="29" />
<application android:requestLegacyExternalStorage="true"  >
</application>    
   
)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
 
Last edited:
Upvote 0

cambol

Active Member
Licensed User
change the uses-permission for 14 ,15 .....to 29 , app still not installing ~~ nothing show in emulator screen.

If I drop android:requestLegacyExternalStorage , It can installing


B4A show Completed successfully.


Building folders structure. (0.06s)
Compiling code. (0.71s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
(Android Support Library)
Generating R file. (0.00s)
Compiling generated Java code. (0.04s)
Convert byte code - optimized dex. (10.65s)
Packaging files. (0.82s)
Copying libraries resources (0.02s)
Found 7 resource files.
Signing package file (private key). (1.71s)
ZipAlign file. (0.03s)
Installing file to device. (3.13s)
Device serial: emulator-5554
Completed successfully.
 
Upvote 0

cambol

Active Member
Licensed User
I haved remove ~ and still can not installing app ~
I think it's some problem with " android:requestLegacyExternalStorage"
 
Upvote 0

cambol

Active Member
Licensed User
if android:requestLegacyExternalStorage not work ~ I want to try set save files in file.dirinternal and copy these file out .

In target level 29 , who to copy these file out ?
 
Upvote 0

cambol

Active Member
Licensed User
upload apk to google play ,and get AndroidManifest.xml more <application> error

My Code


B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>
<application android:requestLegacyExternalStorage="true" >  
</application>
)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
CreateResourceFromFile(Macro, Themes.LightTheme)
 
Upvote 0
Top