Activity Name Required to Auto Start Activity from Play Button in Platform

When I hit the Play button in the platform I get the following message in the output window:



[java]

Starting: Intent { cmp=com.interstatewebgroup.ballchucker/.MainActivity }

Error type 3

Error: Activity class {com.interstatewebgroup.ballchucker/com.interstatewebgroup.ballchucker.MainActivity} does not exist.

Logging android device output, cancel build or disconnect device to stop logging.



[/java]



My AndroidManifest file includes the following:

[java]

<activity android:label="@string/app_name" android:name=“IntroActivity”>

<intent-filter>

<action android:name=“android.intent.action.MAIN”/>

<category android:name=“android.intent.category.LAUNCHER”/>

</intent-filter>

</activity>



[/java]



Does the platform require the activity that starts the app to be called “MainActivity”? I know that is the default name, but we’ve renamed it to something else. Is that not supported?

No its not supported, also not by the android SDK, you will have to change all properties files accordingly, read the android SDK manual (or just keep the name you chose at the beginning or rebuild the android project by deselecting the android deployment once).

I’m not sure what you mean by the “android SDK”. We’ve been running Android projects with activities not named MainActivity for quite a while. The app will actually run when started manually from the phone after the jme platform downloads it to the phone, it just doesn’t start automatically by the platform. If you mean it’s just not supported by the jME Platform, then I understand.

Ah, I thought you just renamed your MainActivity file. In that case yeah, the start command expects the name to be “MainActivity” as that is the file that is being created with the android project and only the package name is being stored.



Edit: You can always copy the target in question from mobile-impl.xml to the build.xml and change the name there, then that copy will be used instead.

1 Like

No big deal. Just didn’t know. I’ll change the app to use MainActivity instead. It’s a nice feature to have the app start automatically, just thought it would look in the manifest to figure out which actviity to start. No big deal. Thanks for the quick response, as always.