DominikR 0 Posted January 31 (edited) Hey, i updated RAD Studio to version 12 last week. Now i wanted to update my app to work with the new android play store requirements. While testing my features i found out, that my app keeps on hanging on a black screen when i try to import a text file with a file explorer. When i manually close the app, and choose a text file and open it with my app it is working fine, but when i open the app, and then go back to my file explorer select the text file to open it again it hangs in a black screen. I tried it also with a completely new project and had the same result. I am using a Pixel 8 with Android 14. I added this intent filter to my AndroidManifest.template.xml in the activity section: <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity" android:exported="true" android:label="%activityLabel%" android:configChanges="orientation|keyboard|keyboardHidden|screenSize|screenLayout|uiMode" android:launchMode="singleTask"> ... <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="text/plain" /> </intent-filter> </activity> And handle it like that: var currentIntent := MainActivity.getIntent(); HandleIntentAction(currentIntent); The handling works like a charm. When starting the app in debugging nothing happens, also logcat is showing noting in regards of my app. I also added some ShowMessages to the FormCreate functions, but also nothing. I added two logcat logs as an attachment to this post. In my opinion there is nothing wrong in the not working log. In addition to the hanging, is there a possibility to open a view directly with an intent because when i try to do a form.show it wont show up, but i haven't followed up on this issue because i wanted to resolve the black screen first. Thank you in advance! Kind regards, Dominik not_working.log working.log Edited January 31 by DominikR Share this post Link to post
Dave Nottage 559 Posted January 31 53 minutes ago, DominikR said: While testing my features i found out, that my app keeps on hanging on a black screen when i try to import a text file with a file explorer. If this is the same issue as I encountered a few months ago (I really should have kept notes), then it's because the Files app ignores singleTask for launchMode and attempts to start a new activity, and Delphi does not support starting a completely new activity in the same app. This is an SO discussion about it being a problem also using Java. I seem to recall that I was going to try and work around it by constructing an Activity in Java, and have it forward the intent to the Delphi app, not trying to start it again if it was already running, of course. I am yet to do anything like that as it's not a priority for me. 1 Share this post Link to post
Dave Nottage 559 Posted February 12 On 1/31/2024 at 9:36 PM, Dave Nottage said: I seem to recall that I was going to try and work around it by constructing an Activity in Java, and have it forward the intent to the Delphi app, not trying to start it again if it was already running, of course. I am yet to do anything like that as it's not a priority for me. Must be having memory issues - see this QP report. My only excuse is that it's from May last year. Share this post Link to post
DominikR 0 Posted April 18 On 2/12/2024 at 10:12 PM, Dave Nottage said: Must be having memory issues - see this QP report. My only excuse is that it's from May last year. I tried this workaround, but I am struggling to get it to work. I always receive this error: java.lang.RuntimeException: Unable to start activity ComponentInfo{XXX/XXX}: android.content.res.Resources$NotFoundException: Resource ID #0x7f020055 Is this because I have not compiled the R.jar? I can not get it to work, because the image does not fit to the version i have installed: Codex/Docs/AndroidTools.md at master · DelphiWorlds/Codex · GitHub Can you maybe explain, why i receive this error, and how to fix it? I am using codex. Share this post Link to post
Dave Nottage 559 Posted April 18 6 hours ago, DominikR said: Can you maybe explain, why i receive this error, and how to fix it? I am using codex. Are you using the latest released version? i.e. Codex 2.2.0? If so, I'll revisit this since I haven't looked at it since upgrading to 12.1. Share this post Link to post
Dave Nottage 559 Posted April 19 3 hours ago, Dave Nottage said: If so, I'll revisit this since I haven't looked at it since upgrading to 12.1. I revisited it anyway, and have attached the updated test project. Using Codex 2.2.0 I downloaded the AndroidX appcompat package (note that it should be v1.2.0 to align with what Delphi 12.1 uses): ..and added it using the Add Android Package menu item that Codex adds to the Project Manager context menu. This is after deploying at least once, so that resources are merged properly. In Delphi 12.1 deploying at least once also means that AndroidManifest.template.xml is created (in 12.0 and earlier it is created when building, rather than deploying), and the following is added to it, just before <%activity%>: <activity android:name="com.delphiworlds.kastri.DWFilesActivity" android:excludeFromRecents="true" android:exported="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="*/*" /> <data android:scheme="content" /> <data android:host="*" /> </intent-filter> </activity> ..and of course, the dw.filesactivity.jar library is added to the Android 32-bit Libraries node (does not need to be added to 64-bit unless you're using Delphi 11.3) RSP41337.zip Share this post Link to post
DominikR 0 Posted April 19 Thank you so much for your help! But I can not get it to work, i am still receiving the same error as yesterday. I have to use the 64bit deployment because my phone has no ABI for 32 bit. What I have done so far: 1. Created the .java file with the correct package name, and it seems to be found, because when i change the package name or file name I receive another error. 2. Added it to my 64Bit libraries 3. Downloaded the appcompat 1.2.0 package and added it to the project (Now the deployment takes more ages then before...) 4. Deployed the application and started logcat and still receive this message: How can I figure out what Ressource it can not find? Because I am not sure what Resource ID #0x7f060055 is. I have to say, after 6 Years of working with Delphi and Android it is so horrible to work with this combination. I had to attach the log as a file, otherwise it said my post is spam... Kind Regards, Dominik logcat.log Share this post Link to post
DominikR 0 Posted April 22 On 4/19/2024 at 2:49 AM, Dave Nottage said: I revisited it anyway, and have attached the updated test project. Using Codex 2.2.0 I downloaded the AndroidX appcompat package (note that it should be v1.2.0 to align with what Delphi 12.1 uses): ..and added it using the Add Android Package menu item that Codex adds to the Project Manager context menu. This is after deploying at least once, so that resources are merged properly. In Delphi 12.1 deploying at least once also means that AndroidManifest.template.xml is created (in 12.0 and earlier it is created when building, rather than deploying), and the following is added to it, just before <%activity%>: <activity android:name="com.delphiworlds.kastri.DWFilesActivity" android:excludeFromRecents="true" android:exported="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:mimeType="*/*" /> <data android:scheme="content" /> <data android:host="*" /> </intent-filter> </activity> ..and of course, the dw.filesactivity.jar library is added to the Android 32-bit Libraries node (does not need to be added to 64-bit unless you're using Delphi 11.3) RSP41337.zip FYI: I tried the project that you attached to this post, and it is also not working for me. I still receive an error message: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.embarcadero.RSP41337/com.delphiworlds.kastri.DWFilesActivity}: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat. Share this post Link to post
Dave Nottage 559 Posted April 22 3 hours ago, DominikR said: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat. What version of Android is on your device, and what make/model of device is it? Share this post Link to post
DominikR 0 Posted April 22 3 hours ago, Dave Nottage said: What version of Android is on your device, and what make/model of device is it? I am using a Pixel 8 with Android 14. Share this post Link to post
Dave Nottage 559 Posted April 22 6 hours ago, DominikR said: I am using a Pixel 8 with Android 14. Not sure what the problem is - it works fine on my Pixel 6 Pro with Android 14. Perhaps try a clean/build. Share this post Link to post