Delphi 10.4: How to start writing Android apps? - android

Until now I have only programmed for Windows, but I would like to try Android.
So, I installed Delphi 10.4 CE with all the options.
Then, I installed all the recommended stuff with SDK Manager.
Then, I connected my (Huawei) phone to my (Windows 10) laptop with USB, and found out how to activate the developer mode and remote debugging.
Then, I created a blank multi device application.
But still, Delphi refuses to even show the "Android" option! (I can only select "Windows 32 bit")
What am I missing? I'm getting desperate after so many hours of searching!
There is no Android option in the Delphi IDE:

Seems like your issue is that Android hasn't been added as a platform option within your project.
First, you'll need to make sure that you have the Android platform installed. You can do this by going to "Tools" and then "Manage Platforms..." from the main menu:
Once you have the Android Platform installed in your IDE, then within your project, you can add it as a platform option by right-clicking on the "Target Platforms" option in your Projects window, then selecting "Add Platform...":
Within that menu, you'll be able to select Android as an option as can be seen in the screenshot below:
Once you have Android added as a platform option, then you should see your phone under "Target":
If you're not sure where to find your Projects window, see below:

Related

Android Emulator cannot be found VS2019

I am attempting to play around a little with xamarin within Visual Studio 2019. I built a new Xamarin Android application and just want to run the base code in the emulator, but I am getting the error in the image below. When I installed VS2019, I did so with the xamarin features including the SDK on my secondary drive and I can see the sdk file on my secondary drive, but am fairly sure that VS2019 is looking with my primary drive for some reason. Is there a way to fix this?
I don't bother with the SDK or emulator packages through the visual studio installer anymore. Install Android Studio, use the tools in that to download the SDK and setup the devices you want to emulate. Then back in Visual Studio, set the paths in the Xamarin/Android Settings in the options menu. Mine look something like this:
Android SDK Location: C:\Users\myusername\AppData\Local\Android\Sdk
Android NDK Location: C:\Users\myusername\AppData\Local\Android\Sdk\ndk-bundle
This setup seems to have much support for Android and gives you the various Google apps and services in the emulators.
Fist, you should check your android sdk path by Tools > Options > Xamarin > Android Settings to view and set the Android SDK location:
For more details, you can check here.
Meanwhile, you should check the Android SDKs and Tools by steps: Tools-> Android->
Android SDK Manager...,then you need install the platforms and Tools you need.E.g.
It seems a little bit late, but I faced this issue and I did the following to sort it out:
Be sure that the BIOS virtualization is enabled
Run the VS2019 as an administrator and run the Android device manager
Wait a for seconds it takes some times
After getting the screen of the Android device manager press the (+) plus button
If you get the menu titled New Device then cancel the creation of a new device
close VS2019 and log out the administrator account
Log in again with your account and run the Android device manager
Hope this may help

Android developement with Delphi on One Plus X: how to?

I own Delphi 10 Seattle and I am struggling to setup my IDE for Android development.
My phone is One Plus X.
I went through the docs at embarcadero website, in particular this page
I did all up to point (6), but point (7) is not ok: I do not see my device.
I tried to go through all the points several time, I also made sure to run explorer with elevated privileges to be sure that everything is installed fine. Anyway as I choose Android as target platform there is no way to see my phone in the "Target" folder.
Did anyone manage to use One Plus X (and its drivers) for Android Development on Delphi Seattle?
I used this driver as USB driver for one plus X, having no errors on installation
After retrying for the nth time i manager do see my phone.
Success come after following step by step this guide:
Start the Android SDK Manager by selecting Start | All Programs | Embarcadero RAD Studio | Android SDKs | Android Tools
Caution: Use only the Android SDK Manager that is available in the Android Tools node on the Start menu.
Do not use any other Android SDK Manager that might be installed elsewhere on your system.
A command window opens, and then the Android SDK Manager opens.
In the Android SDK Manager:
Scroll down to Extras.
Select the Google USB Driver.
Clear all other checkmarks, such as automatic checkmarks in the Android 4.3 and Tools sections.
Note: We recommend that you do not install additional libraries or updates except as distributed by RAD Studio.
Click Install 1 Package.
Power up your Android device and connect it by USB cable to your development system.
In the system Control Panel, search for and select "update device drivers" in order to open the Device Manager.
In the Device Manager, locate and right-click your Android device, and select Update Driver Software.
In the Update driver software dialog box, browse to the \extras folder in your Android SDK directory, and select the folder that matches your Android device. (For example, select google for the Nexus 7 or Nexus 10 tablet.) Then click OK.
Note: This is the location of the Google USB driver in our default Android SDK installation: C:\Users\Public\Documents\Embarcadero\Studio\18.0\CatalogRepository\AndroidSDK-<Version>\extras\google\usb_driver.
OnePlus added to the list:

Issues after installing Xamarin

I got a new laptop this week (Win10), installed Visual Studio 2015 community, followed by Xamarin. I've created a blank Android project, uncommented the SetContentView(...) line in MainActivity.cs, then build the solution. However I'm running into various problems when I try to run it:
The list of emulators (next to the green "run" button) only contains two entries: "Android_accelarated_x86 (Android 6.0 - API 23)" and "Android_ARMv7a (Android 6.0 - API 23)". Is this normal? The Xamarin doc'n seems to suggest that a number of "Xamarin xxx" emulators would be installed.
When I run the project against "Android_accelarated_x86", the emulator starts up, Visual Studio reports the deployment is successful, but Visual Studio stops debugging. In the output window I see this:
InspectorDebugSession(0): StateChange: Start -> EntryPointBreakpointRegistered
InspectorDebugSession(0): Constructed
Android application is debugging.
Couldn't connect to logcat, GetProcessId returned: 0
InspectorDebugSession(0): HandleTargetEvent: TargetExited
InspectorDebugSession(0): Disposed
If I hit run again, the app seems to start on the emulator, but then a message appears saying "Unfortunately xxx has stopped" (where xxx is my project name). The above messages appear in the VS windows again (apart from the one about 'Couldn't connect to logcat...').
I've also noticed that the "Manage Virtual Devices" item in the dropdown is greyed out, so I presumably can't try creating a different emulator?
Shooting from the hip on this one but do you have the Android SDK installed? It should install a number of other emulators and give you access to the device manager.
There are emulators you can INstal with Visual Studio. Emulators that come with the Android SDK and emulators that install with Xamarin Studio.
One additional thing to try would be to install Xamarin Studios. It does a slightly better job in my experience of setting up your environment then VS Does.
Firstly, the Manage Virtual Devices is referring to Xamarin Android Player VMs (which is now deprecated). We're working on getting this removed if Xamarin Android Player isn't present.
To create / edit / fix your Google AVD VMs you should select Android Emulator Manager. Regarding the number of devices listed, I'd probably ensure everything Xamarin is updated..
Visual Studio > Tools > Options > Xamarin > Other > Check for Updates
..and also update all your SDK components. If you have an Intel CPU you should use the x86 images for best performance. If you haven't already installed this you can get it here:
https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager
If you update any images it could be that your AVD needs repairing, which you can do in the Android Emulator Manager by selecting the relevant image and clicking Repair.
Also, you will only be able to deploy to devices that your project is targeting, so it's worthwhile checking the AndroidManifest.xml or by right-clicking your project and checking the 'minimum' and 'target' Android API levels to ensure you're encompassing the AVDs you have created.

Visual Studio Android Emulator won't run application

I recently got into Xamarin development. I have a lot of experience in Xcode making iOS apps and the iOS side was very straight forward. Now I'm trying to implement Android. I downloaded a Hello World example to get my bearings. When I run it I have no problems getting the simulator to show up (MonoForAndroid_API_10 and MonoForAndroid_API_12) but the actual application doesn't run, and does not show up anywhere on the simulator. Essentially whenever I use run or run with in Xamarin on Android, it pulls up a fully functioning, albeit empty simulator.
How do I get my application to run on the emulator?
Like the other commenters, this is most likely just a symptom of slow emulator on your machine. I'm running Xamarin-Android development on my 2010-era OSX machine in mavericks with 8GB RAM, and it is slow-slow-slow, but usable. Try to find the Intel x86 speeds improvements (look for HAXM) and you will find that the emulator will be much much faster.
And yeah, get a real handset and plug it in to your computer: always much faster than emulation.
later edit Get Genymotion for Mac OSX or for PC/Windows or PC/Linux. It's way way way faster than the other emulators. I have since found that this is as fast, or faster, than running the App on my connected Android phone. It's certainly simpler in not having to have the device plugged into one of my USB ports, and allows me to code and test on the train. http://www.genymotion.com/
Don't know if my issue was the same but finally this troubleshooting helped me to run emulator https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB.
I was missing key Android SDK Tools with string value Path in registry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
I've created it manually and it worked.
UPDATE
Before I got the issue with running emulator, I couldn't see it in Visual Studio. The reason was I've installed VS Android Emulator through standalone installation, not through VS Installer. It had to be installed there as well.
I had the similar issue, and then I deleted the existing device simulator and reinstalled again and it started working.
As I use a different SDK, in my case
Go to Tools > Options > Xamarin and set the Android SDK path.
Sometime Visual Studio changes this configuration;
2020 Update:
I followed the most voted comment, however, with Visual Studio 2019 updated recently, the steps have changed a little. Here is what previously worked:
WHAT WORKED BEFORE
"Don't know if my issue was the same but finally this troubleshooting helped me to run emulator https://msdn.microsoft.com/en-us/library/mt228282.aspx#ADB. I was missing key Android SDK Tools with string value Path in registry Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
I've created it manually and it worked."
WHAT TO DO INSTEAD
Nothing. Don't mess with the path.
WHAT WORKED BEFORE
"Before I got the issue with running emulator, I couldn't see it in Visual Studio. The reason was I've installed VS Android Emulator through standalone installation, not through VS Installer. It had to be installed there as well."
Previous instructions image
WHAT TO DO INSTEAD
a. Go to Tools located at the top of the VS window, Get Tools and Features, go to Individual components, using the search tool in the pop up box, search "emulator", once you get the result, make sure both Google Android Emulator (API Level 25)(local install) and Intel Hardware Accelerated Execution Manager (HAXM) (local install) are both checked.
b. Close the solution(s) and restart VS then reopen the solution(s).
c. To deploy the app on the emulator, click Start button to spin up the emulator, left click on your Android project, then click Deploy. You should be able to see your app on your emulator's app menu.
Updated Instructions image
Worked for ME
Sometimes you close the android Emulator but not POWEROFF the Emulator.
this problem happens when emulator shutdown un-properly.
Restart Your EMULATOR
First start your emulator
Then restart your emulator by pressing down the power button and select restart option in your android emulator.
I enabled Hyper-V acceleration based on microsoft documentations: https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/hardware-acceleration?tabs=vswin&pivots=windows#accelerating-with-hyper-v
Basically you need to turn on these two windows features from the control panel (Turn windows features on of off):
Hyper-V.
Windows hypervisor platform.
then from visual studio go to: Tools >> Android >> Android SDK manager >> Tools >> make sure that "Android emulator" version is 27.0.1 or higher, if not, you will find in the same screen a button below to update it.
I did this on windows 10 64-bit, with VS 2017 Community 15.9.5

How to I emulate a specific Android device via AVD?

(This question may belong on a different site such as SuperUser. If so, please migrate!)
I'm trying to do a lot of debugging of our web app for Android. The Android emulator seems a tad more difficult for me to get running than the iOS ones. ;)
I have installed the proper Java JDK and Android SDK.
I can now launch AVD manager. This is where I'm stuck. I understand this is where we can customize the specifications of our particular device, but to create a new virtual device, I need to choose a target. However, my target menu is grayed out. I'm guessing there's one more thing I need to install, but I'm lost as to what that is. (BTW, for starters, I'm trying to emulate the Thunderbolt).
Check this out. You probably missed step 4
Installing the SDK
Installing the Android SDK does not install one of the Android platforms to build a AVD from.
To install a platform do the following:
Open the Android SDK Manager (located in the Android SDK directory as tools\android).
Select at least one Android platform to install, and click Install Selected. Depending on the version of Android running on the Thunderbolt, you would most likely choose to install Android 2.2 or Android 2.3).
Once this installed the target menu will display the version you installed.

Categories

Resources