Angelo Maradini Member Licensed User Longtime User May 14, 2021 #1 I would like to install in Android 11 an app realized with B4A last year. When I install the app from apk, I receive a message like this: " This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer." so I set in manifest targetSdkVersion="29" AddManifestText(<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29"/> ... ) in this way I could install the app, the message disappears but the app can't run. a white screen appears and disappears suddenly could someone help me please?
I would like to install in Android 11 an app realized with B4A last year. When I install the app from apk, I receive a message like this: " This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer." so I set in manifest targetSdkVersion="29" AddManifestText(<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="29"/> ... ) in this way I could install the app, the message disappears but the app can't run. a white screen appears and disappears suddenly could someone help me please?
mcqueccu Expert Licensed User Longtime User May 14, 2021 #2 Not enough information. What does the app do? Are you loading the layout? Upvote 0
Angelo Maradini Member Licensed User Longtime User May 14, 2021 #3 if I install the same apk in android10 it works, the problem is in Android11 the first page contains some buttons and images Upvote 0
if I install the same apk in android10 it works, the problem is in Android11 the first page contains some buttons and images
Star-Dust Expert Licensed User Longtime User May 14, 2021 #4 Surely it accesses resources that are no longer available on SDK 29 and crashes. This App maybe accesses the root external memory? Upvote 0
Surely it accesses resources that are no longer available on SDK 29 and crashes. This App maybe accesses the root external memory?
josejad Expert Licensed User Longtime User May 14, 2021 #5 Can you run B4A-Bridge in the phone with Android 11 and run the app in debug mode to check the logs? Upvote 0
agraham Expert Licensed User Longtime User May 14, 2021 #6 Probably due to permissions or new privacy limitations in Android 11 (1) android.jar / targetSdkVersion / minSdkVersion | B4X Programming Forum Upvote 0
Probably due to permissions or new privacy limitations in Android 11 (1) android.jar / targetSdkVersion / minSdkVersion | B4X Programming Forum
Angelo Maradini Member Licensed User Longtime User May 17, 2021 #7 In debug I see the wrong line is this: File.Copy(File.DirAssets, vFileName, File.DirDefaultExternal, vFileName) I can't copy a file and the error in log is java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.company/files/FileName.db: open failed: ENOENT (No such file or directory) this happens only in android 11, not in Android 10... Upvote 0
In debug I see the wrong line is this: File.Copy(File.DirAssets, vFileName, File.DirDefaultExternal, vFileName) I can't copy a file and the error in log is java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.company/files/FileName.db: open failed: ENOENT (No such file or directory) this happens only in android 11, not in Android 10...
DonManfred Expert Licensed User Longtime User May 17, 2021 #8 ExternalStorage - Access SD cards and USB sticks Before we start: External storage means a real sd card or a connected mass storage USB device. This class can also be used to access the secondary storage (File.DirRootExternal). This becomes relevant with newer versions of Android that restrict direct access. It has nothing to do with runtime... www.b4x.com Upvote 0
ExternalStorage - Access SD cards and USB sticks Before we start: External storage means a real sd card or a connected mass storage USB device. This class can also be used to access the secondary storage (File.DirRootExternal). This becomes relevant with newer versions of Android that restrict direct access. It has nothing to do with runtime... www.b4x.com
agraham Expert Licensed User Longtime User May 17, 2021 #9 Angelo Maradini said: File.DirDefaultExternal Click to expand... Is the problem. You need to request storage permission and add the manifest entry for for targeting SDK 29 which is in the link I gave you above. Sorry! I sloppily assumed it was File.DirRootExternal instead of reading it carefully. Upvote 0
Angelo Maradini said: File.DirDefaultExternal Click to expand... Is the problem. You need to request storage permission and add the manifest entry for for targeting SDK 29 which is in the link I gave you above. Sorry! I sloppily assumed it was File.DirRootExternal instead of reading it carefully.
M MbedAndroid Well-Known Member Licensed User Longtime User May 19, 2021 #10 i thought copying a file from assets to dirinternal is also not possible with sdk30. Upvote 0
Erel B4X founder Staff member Licensed User Longtime User May 20, 2021 #11 MbedAndroid said: i thought copying a file from assets to dirinternal is also not possible with sdk30. Click to expand... No such restriction. Upvote 0
MbedAndroid said: i thought copying a file from assets to dirinternal is also not possible with sdk30. Click to expand... No such restriction.
Angelo Maradini Member Licensed User Longtime User May 21, 2021 #12 I haven't yet solved this bug. someone could help me,please? any ideas? Last edited: May 21, 2021 Upvote 0
josejad Expert Licensed User Longtime User May 21, 2021 #13 Angelo Maradini said: someone could help me,please? Click to expand... Upload a small project that shows the problem, it will be easier to help you. Upvote 0
Angelo Maradini said: someone could help me,please? Click to expand... Upload a small project that shows the problem, it will be easier to help you.
M MbedAndroid Well-Known Member Licensed User Longtime User May 21, 2021 #14 manifest: check B4X: SetApplicationAttribute(android:requestLegacyExternalStorage, true) AddManifestText(<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="19" />) in b4a code check or add B4X: If Sys.SDK>22 Then rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE) Wait For Activity_PermissionResult (Permission As String, rresult As Boolean) If rresult Then ............. End If End If this is working on android11. There are many examples on the forum Upvote 0
manifest: check B4X: SetApplicationAttribute(android:requestLegacyExternalStorage, true) AddManifestText(<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="19" />) in b4a code check or add B4X: If Sys.SDK>22 Then rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE) Wait For Activity_PermissionResult (Permission As String, rresult As Boolean) If rresult Then ............. End If End If this is working on android11. There are many examples on the forum
M Mahares Expert Licensed User Longtime User May 21, 2021 #15 Angelo Maradini said: File.Copy(File.DirAssets, vFileName, File.DirDefaultExternal, vFileName) Click to expand... This line: Code: File.Copy(File.DirAssets, vFileName, File.DirDefaultExternal, vFileName) should be: Code: File.Copy(File.DirAssets, vFileName, rp.GetSafeDirDefaultExternal(""), vFileName) 'need rp as runtimepermissions lib It works with SDK 30 and device running OS 11. MbedAndroid said: i thought copying a file from assets to dirinternal is also not possible with sdk30. Click to expand... Why are you making such incorrect statement. We are already all confused with all these new permissions maze and you add another cork to it. Upvote 0
Angelo Maradini said: File.Copy(File.DirAssets, vFileName, File.DirDefaultExternal, vFileName) Click to expand... This line: Code: File.Copy(File.DirAssets, vFileName, File.DirDefaultExternal, vFileName) should be: Code: File.Copy(File.DirAssets, vFileName, rp.GetSafeDirDefaultExternal(""), vFileName) 'need rp as runtimepermissions lib It works with SDK 30 and device running OS 11. MbedAndroid said: i thought copying a file from assets to dirinternal is also not possible with sdk30. Click to expand... Why are you making such incorrect statement. We are already all confused with all these new permissions maze and you add another cork to it.
M MbedAndroid Well-Known Member Licensed User Longtime User May 21, 2021 #16 Why are you making such incorrect statement. We are already all confused with all these new permissions maze and you add another cork to it. Click to expand... well i tried it once, and didnt worked on android 11. I couldnt copy a manual into file.internal. So i said "thought". But to sort things out, i tried it again, and now without issues. Dont know why it didnt worked out first time. Last edited: May 21, 2021 Upvote 0
Why are you making such incorrect statement. We are already all confused with all these new permissions maze and you add another cork to it. Click to expand... well i tried it once, and didnt worked on android 11. I couldnt copy a manual into file.internal. So i said "thought". But to sort things out, i tried it again, and now without issues. Dont know why it didnt worked out first time.
Angelo Maradini Member Licensed User Longtime User May 24, 2021 #17 Thanks at all, in particular to Mahares! I have solved changing File.DirDefaultExternal with rp.GetSafeDirDefaultExternal("") Good job!!! Upvote 0
Thanks at all, in particular to Mahares! I have solved changing File.DirDefaultExternal with rp.GetSafeDirDefaultExternal("") Good job!!!