I've created a wear app and used the Android Studio template to create it and haven't made any changes other than to drag and drop a button onto the MainActivity of the wear app.
When I try and run the watch app in the Run/Debug Configurations is Launch default Activity is ticked then there is an error message saying: "Error: Default Activity not found".
I've searched for previous posting on this and the answer is messing around with module sources and stuff. Is that really the correct solution in this situation? If so, then why isn't the Android Studio setting everything up correctly in the first place - after all the project was created by an AS template, why isn't the template setting things up correctly?
If its not applicable, then how do I get the watch app to execute and launch its activity when executed directly using Studio?
Studio Version: 1.0.2
I also had an issue similar to this after adding a Watchface, and thought I would chime in with what fixed it for me.
In Android Studio 2.2.1: Run -> Edit -> Your App -> watchface -> General -> Launch Options -> Launch: Nothing
By default, mine was selected to run the default activity, which is incorrect for a watch face.
In AndroidManifest.xml file for wear, make sure that there is at least one activity and the activity that you want to launch has the following intent-filters in it:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
There is another tip mentioned in this answer.
The sample code for the Watch Face contains the following comment
Important Note: Because watch face apps do not have a default Activity in their project, you will need to set your Configurations to "Do not launch Activity" for both the Wear and/or Application modules. If you are unsure how to do this, please review the "Run Starter project" section in the Google Watch Face Code Lab: https://codelabs.developers.google.com/codelabs/watchface/index.html#0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With