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

后端 未结 3 638
天命终不由人
天命终不由人 2021-01-03 21:14

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 we

相关标签:
3条回答
  • 2021-01-03 21:45

    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.

    0 讨论(0)
  • 2021-01-03 21:47

    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

    0 讨论(0)
  • 2021-01-03 22:03

    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.

    0 讨论(0)
提交回复
热议问题