“Default activity not found” for a wearable app created with Android Studio template

烈酒焚心 提交于 2019-11-30 17:30:12
Kevin Gray

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.

sahilkhosla

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!