Fire Beta: Unable to run template Android Application (Swift)

I have created a brand new template Android Application (Swift), and I cannot run on the device since latest version of Fire beta.
I see the device connected in the devices list, and the target disabled in the targets list.

The same happens in a more complex project with several solutions (like iOS, Shared libraries, etc), as showed in the next screenshot:

You can see that only the iOS target is active, while the Android is grayed. The device is in the devices list.

The device is unlocked as a developer device, and it is seen by adb:

macbookproloreto:MXMPortableNETLib admin$ adb devices
List of devices attached
0a21584f	device

In the project settings I see an “Unexpected value” in CrossBox Device ID:

Is the output type set to Library or to Executable? Try setting it to Executable.

@mh didn’t change that, how to do?

It’s in Settings. I did change Fire to be stricter, and not allow Library projects to run. I’ll review though how that applies to Android, and whether to fix the template, or tweak the logic in Fire further.

Ah weird, here is:

<ProjectGuid>929B265F-D81D-4090-8C42-E860E7192630</ProjectGuid>
    <OutputType>Library</OutputType>

So it was a default settings that was wrong, while in the iOS template is

<RootNamespace>iOSSilverSampleApp</RootNamespace>
        <ProjectGuid>D4CFC236-2049-4544-B9F4-999B053B9F53</ProjectGuid>
        <OutputType>executable</OutputType>
        <AssemblyName>iOSSilverSampleApp</AssemblyName>

…uhm maybe it needs something elsewhere:

Errors:

/Users/admin/Projects/MusiXmatch/MXMPortableNETLib/MXMSilverSDK.sln (Build) ->
(Build target) ->
/Users/admin/Projects/MusiXmatch/MXMPortableNETLib/Samples/AndroidSilverSampleApp/AndroidSilverSampleApp.elements (default targets) ->
/Applications/Fire.app/Contents/Resources/XbuildTargets/RemObjects Software/Oxygene/RemObjects.Oxygene.Cooper.Common.targets (CoreCompile target) ->

        : error E103: Could not find a "Main" method in this project

Yeah, i’ll need to revert Fire to allow running libraries for Android (but not for plain Java)

ah so it changed since previous version (I was able to run the android app template)…? Thanks.

Yes, that was a fret change in Fire; an over-eager one it turns out :wink:

1 Like

Ok, so I have updated Fire.
I have started from scratch a new Android Application project in the current solution.
Now I can run this kind of template project.

The console prints

Installing org.me.androidsilversampleapp
Calling adb -s 0a21584f install -r "/Users/admin/Projects/MusiXmatch/MXMPortableNETLib/Samples/AndroidSilverSampleApp/./bin/Release/AndroidSilverSampleApp.apk"

I had to set the configuration to Release for this target.

and then it freezes for a while and then:

The process failed to start with the following error:

Starting: Intent { cmp=org.me.androidsilversampleapp/.MainActivity }

I have just created a project without any change so I have a basic

public class MainActivity: Activity {

	public override func onCreate(savedInstanceState: Bundle!) {
		super.onCreate(savedInstanceState)
		ContentView = R.layout.main
	}
}

If I open Android Monitor from AndroidStudio, I can see:

02-29 11:03:27.430 605-1260/? I/ActivityManager: Force stopping org.me.androidsilversampleapp appid=10086 user=-1: set debug app
02-29 11:03:27.430 605-1260/? I/ActivityManager: START u0 {flg=0x10000000 cmp=org.me.androidsilversampleapp/.MainActivity} from uid 2000 on display 0
02-29 11:03:27.449 8038-8038/? D/AndroidRuntime: Shutting down VM
02-29 11:03:27.466 605-1367/? I/ActivityManager: Start proc 8059:org.me.androidsilversampleapp/u0a86 for activity org.me.androidsilversampleapp/.MainActivity
02-29 11:03:27.504 717-717/? V/PhoneStatusBar: setLightsOn(true)
02-29 11:03:27.511 8059-8059/? W/ActivityThread: Application org.me.androidsilversampleapp is waiting for the debugger on port 8100...

as it was likely waiting for debugger (even if the target was set to Release).

In Settings the CrossBox Device ID is still unexpected value.

If I try to set to Debug configuration I get a “unable to deploy” error instead, after freezing and I can see on the Nexus 7 a alert entitled Waiting for Debugger.

@mh I did further tests and I can see that for this Android Application here:

The app hangs on a brand new install of the Xamarin Android Player / Nexus 7 (marshmallow)

This is what happens on a real device too (Nexus 7 as well);

Both devices are attached to the adb:

macbookproloreto:~ admin$ adb devices
List of devices attached
10.71.34.101:5555	device
0a21584f	device

and I can run from Fire so I see from the CrossBox devices popup then.

I confirm that the configuration of devices / adb / android seems to be ok, since

This is the emulator logs (That hangs running from Fire):

03-03 16:22:27.856  1491  1491 D AndroidRuntime: Shutting down VM
03-03 16:22:27.863   330   957 I ActivityManager: Start proc 1501:org.me.androidsilversampleapp/u0a52 for activity org.me.androidsilversampleapp/.MainActivity
03-03 16:22:27.871  1491  1494 I art     : Debugger is no longer active
03-03 16:22:27.889  1501  1501 W ActivityThread: Application org.me.androidsilversampleapp is waiting for the debugger on port 8100...
03-03 16:22:27.890  1501  1501 I System.out: Sending WAIT chunk
03-03 16:22:27.926   330  1296 I OpenGLRenderer: Initialized EGL, version 1.4
03-03 16:22:27.949   805   955 E Surface : getSlotFromBufferLocked: unknown buffer: 0xaf0f2380
03-03 16:22:27.956   330  1296 W EGL_xap : eglSurfaceAttrib not implemented
03-03 16:22:27.956   330  1296 W OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0x9db933e0, error=EGL_SUCCESS
03-03 16:22:28.093  1501  1507 I art     : Ignoring second debugger -- accepting and dropping
03-03 16:22:31.456   330   563 D TaskPersister: removeObsoleteFile: deleting file=16_task.xml
03-03 16:22:31.456   330   563 D TaskPersister: removeObsoleteFile: deleting file=16_task_thumbnail.png
03-03 16:22:37.851   330   394 W ActivityManager: Launch timeout has expired, giving up wake lock!
03-03 16:22:41.665   330   534 E WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=any RSSI=-55
03-03 16:23:01.667   330   534 E WifiStateMachine: WifiStateMachine CMD_START_SCAN source -2 txSuccessRate=0.00 rxSuccessRate=0.00 targetRoamBSSID=any RSSI=-55

I don’t get what means this message from Art:

  03-03 16:22:27.871  1491  1494 I art     : Debugger is no longer active

that makes a lot of sense as soon as we look at the popup on the device emulator.
So the issue was that running as a Release configuration it start debugging, while running as Debug configuration, debugging starts since I can see:

03-03 16:26:13.967  1593  1599 I art     : Debugger is active
03-03 16:26:13.983  1593  1593 I System.out: Debugger has connected
03-03 16:26:16.193  1593  1593 I System.out: waiting for debugger to settle...
03-03 16:26:16.282   330   563 D TaskPersister: removeObsoleteFile: deleting file=19_task.xml
03-03 16:26:16.282   330   563 D TaskPersister: removeObsoleteFile: deleting file=19_task_thumbnail.png
03-03 16:26:16.394  1593  1593 I System.out: debugger has settled (1425)

To recap, the Release configuration seems to start a debugging session, that is the error (not sure it’s my side or Android Application template side…