Reputation: 3520
This https://developer.android.com/guide/topics/appwidgets/#preview says
To help create a preview image for your app widget (to specify in the previewImage field), the Android emulator includes an application called "Widget Preview." To create a preview image, launch this application, select the app widget for your application and set it up how you'd like your preview image to appear, then save it and place it in your application's drawable resources.
I can't find this application on the latest Android system image, Android Oreo (8.1) API 27
This question has been asked and answered here, Widget preview image, but the application is missing.
So how do I generate a preview image?
Upvotes: 17
Views: 2931
Reputation: 1
Long press on App Icon in emulator . You will see an option of Widgets, Click on Widget and drop on Home screen and Widget created.
Upvotes: -2
Reputation: 252
The Widget Preview app will only show up when running an older version of Android on an emulator (API 26 or lower).
If the Widget Preview isn't showing up on your emulator, you need to create a new Virtual Device with a lower API in Android Studio:
1) Tools>AVD Manager>Create Virtual Device...
2) Select the device you'd like to use, click "Next"
3) In the next window, select Nougat, API Level 25. You may need to download it if you've never used it before. Click "Next", then "Finish"
4) Run the app on the new virtual device, and search for the Widget Preview again
After the preview has been created, the emulator gives you the option of emailing it so you can save it locally and later to the drawables folder of your project.
Hope that solves it for you too!
Upvotes: 12
Reputation: 3520
Future readers, I solved this by using an older android version system image.
Upvotes: 3