First try of Oxygene in Android... and first problems

Hello,
Having time, I’m trying to play with Android development.

I have installed, the last Java and Android SDK and Android studio, I’ve tried the “Hello World” defaut application in Android Studio and the emulator show the application output: great.

Now, let’s try with Oxygene
I created an Oxygene Android application in VS2019 and doesn’t change it. Run it: the emulator is opened, but the application doesn’t show. After some time, VS displays an error message:

Starting: Intent { cmp=OrdinaSoft.HelloWorld/ordinasoft.helloworld.MainActivity }
Error type 3
Error: Activity class {OrdinaSoft.HelloWorld/ordinasoft.helloworld.MainActivity} does not exist.

Now, let’s try with Water
I close VS, open the solution under Water and run it: the application shows.
Trying with a custom Android machine (Android 10): it works.
Trying with a custom Android machine (Android 9): it doesn’t work: the emulator starts but the application doesn’t load.

~> Android Emulator Huawei P10 failed to boot. Booted Emulator not found after 120s.

I can suppose that my setup is correct, because I can run my application under Water.

But:

  1. I cannot run the application from Visual Studio 2019.
  2. I cannot run the application from Water with my Android 9 custom machine.

That’s very curious. There seem to be two separate issue happening here

#1

The error you’re getting in VS sounds like a broken/incomplete binary (ie the app deploys fine, but it can’t find your class inside it). Since the build process is there same from VS or Water, for Android, thats odd. Is this the same project you later opened in Water, or did you create a second one?

  • Does the issue form VS persist if you do a clean/rebuild and run again? If so, can I get a most-detailed level build log of the rebuild?
  • If the project is not the same, does opening the project you created in Water in VS and running it from there work? Bot immediately, and when doing a clean/rebuild from VS? Does the project created in VS work from Water?

#2

So essentially, it seems that the first emulator boots up ok, but the second one does not. Do you get any more details in the Build or Debug log in Water when it boots the emulator? The build log should also sow the command line we run to boot it (it’s a standard Android tool chain command). If you run the same command manually in a console, does the emulator boot up there? Does that emulator boot ok from Android Studio and/or the Android Virtual Devices Manager tool?

thanx,
marc

It’s the same project.

I’ve just try to restart the machine, delete the project, re-create it in Water: same result.
Now, when I try to run it in the Android 10 custom emulator, I have the following screen (Water doesn’t complain, but 2nd try was OK):

After I close Water and open the project in VS2019 (no compile), still the same: the emulator shows, but not the application on it.

Build log: BuildLog.txt (60.3 KB)
Debug output: BuildLog.txt (60.3 KB)

Running C:\Users\Patrick\AppData\Local\Android\sdk\emulator\emulator.exe -avd Huawei_P10 -verbose
PORT IS ‘5554’
Waiting for Emulator, checking C:\Users\Patrick\AppData\Local\Android\sdk\platform-tools\adb.exe devices' Waiting for Emulator, checking C:\Users\Patrick\AppData\Local\Android\sdk\platform-tools\adb.exe devices’

The emulator boots (as from Water), but it doesn’t display the application…
Here is the command line output: ManualStart.txt (27.0 KB)
I’ve deleted and re-created the emulated device and it now works.

But you said it didn’t boot, from Water? the Android 9 one? The app would ofc not install, if you just run the launch command manually, as that’s a separate step.

Ok.As unsatisfying an answer as that might be, I think we’ll just have to blame this on a broken emulator setup. I’m finding (in my very limited actual use, that is) the entire Android emulator tool chain to be very flaky. Emulators often just dont boot, or ones that were working fine stop working and need to be re-created. All of that is mostly out of our control, as all we really do is run the adb and emulator command line tools that the Android SDK provides, and when those fail (for whatever and often obscure reasons), it’s out of our hand — as much as that sucks in terms of there UX we can wand want to provide :(.

FWIW, things were much the same on the iOS front, until Apple introduced, a few years back, an official command line API for the Simulator — which still can be flaky, but is somewhat reliable (especially when expecting certain known flakiness and knowing how to recover from it, such as simply killing and restarting a Sim that fails to boot, etc).

As for the first issue, so if I understand it correctly, there same project, consistently, will fail with “class not found” when launched need from VS, and runs fine the launched form Water, on the same device/emulator? That’s super weird (I’ll review the build logs in a bit). What happens if you laucht eh app from VS (let it fail) and then manually launch h it on device, vs when you do the same from Water *(launch it, kill it, and then manually launch it)? Does manually launching it work both times, or does the manual relaunch fail too, from VS?

That’s the same log file twice, FWIW.

1>		                     dex> processing ordinasoft/helloworld/MainActivity.class...

definitely looks like the class is going into the binary just fine…

I’ve switched my old Android phone to developper mode and also tried on it. Results are the same as for the emulators.
Here is a summary of what I found:

  • Android Studio: is working fine
  • Water: is working fine.
  • VS2017 / 2019: application is installed, but not started.

So it seems that the problem is related to VS only.

How can they be the same, when the problem with the emulator was that not failed to boot up? We don’t boot up live devices…

Ok, so only the first issue remains, essentially. very odd, I’ll need to have someone from the VS team have a look, this is really strange.

What about this part:

Also, can you send me the final build .apk file after a clean/rebuild in VS, and then the same from a clean/rebuild in Water? thanx!

Also, if you manually run

.../Android/sdk/platform-tools/adb -s emulator-5554 install -r /.../bin/Debug/com.your.app.apk

on the VS-built .apk (replacing emulator-5554 with the name of your emulator), does that app run, manually?

For Visual Studio: VS - ordinasoft.helloworld.zip (63.9 KB)
For Water: Water - ordinasoft.helloworld.zip (63.9 KB)
The zip files are slighltly different (certainly on the date and time of the files), but the files on it are the same.

The command does install the application, but not run it. But if I start the application manually, it works.

1 Like

On more Q (and a half):

the class its complaining abbot missing, is that the proper name of it? Also, can you run “add logcat” on there side and get the full& lg around the place where this fails? this should include an call exception stack for the missing class and (possibly) details as to why its not found.

Also, what build are you using? and I assume default settings (PreDex)?

It seems there are 3 questions here :smile:

Yes, it’s the proper name.

I don’t know how to do this…
BUT, if I start manually the application on the Android virtual machine, I don’t have the error, but a breakpoint is not hit.
If I don’t start manually the application, the error message appears about 30 seconds after the “run” command.

The build of what?
I just installed the last JDK I have found, the last Android Studio and the last version of Elements.

I think you can easily reproduce the problem by creating a new Android in VS and running it. No change is required in the source code.

So if I run with an emulator running, it works fine for me.

If I run it WITHOUT an emulator it fails the first time around (tries to install while stil booting, will log).

If I then run it again it works:

this is a new android app / Oxygene.

Am I missing any step?

We should have something different, because it doesn’t work from VS 2019 in my setup…

in the command line window, run “adb logvat”. it should be on the path; if not it’s in the platform-tools folder of your Android SDK install.

obviously it won’t, no.

Elements?

Three of us have tried and cannot reproduce this, so far, so, no :(.

Elements build is .2469 at the beginning. Starting at today, it is .2471.

1 Like

Carlo,
Very interesting: If I don’t change the application name at creation and let it be “org.me.androidapplication1”, it works!
If I rename it “OrdinaSoft.HelloWorld”, it doesn’t work!
Note that, in this case, the namespace is all lowercase.

Ah, so mixed-case namespaces fail from VS, but not Water?

Background: in Java/Android all namespaces are lowercase. It must be that VS neglects to properly lower-case the namespace it passes to the debugger — we’ll investigate. thanx!

Thanks, logged as bugs://83776

1 Like