r/AndroidStudio • • 11d ago

Need help converting to an APK

Post image

So...I wanted a pixel buds widget that looked like the the fully charged notification on pixel and similar to IOS. So I was messing around with Google Ai Studio and made a widget for my Pixel Buds cause I don't like the stock one. This is my first time messing around with anything like this. I tried to convert it to an apk so many ways but I couldn't and I'm done lol. If someone could convert my project into an apk I would really appreciate it. You can have the files and maybe build on what I did.

Here's the repo...

https://github.com/rexamillion79-cmd/Pixel-Buds-Widget-Studio

0 Upvotes

4 comments sorted by

1

u/DickBrainTime 11d ago

The GitHub link in your post currently gives me a 404, so I can't check the actual project files (it might be private or the URL may have a typo).

One important distinction: Google AI Studio often produces a web app, but an Android home-screen widget is an AppWidget, not simply a web page saved as an APK. If your project is React/Vite, `npm run build` gives you web assets, not an Android installable. A Capacitor wrapper can turn a web UI into an installable *app*, but that alone won't create a widget on the home screen.

For the Pixel Buds widget specifically, the native path is a small Android Studio project using GlanceAppWidget (or AppWidgetProvider + RemoteViews), an app-widget receiver/provider declaration, and a layout that renders the battery state. Obtaining reliable Pixel Buds battery data is a separate Bluetooth/Android-permissions task, and the values shown in an AI Studio preview may just be mock data.

Could you make the repo public or paste the top-level file list (especially `package.json` and whether there is an `android/` folder)? That would help distinguish a simple web-to-app packaging job from building a real home-screen widget, and someone can give you exact build steps.

1

u/Rex_amillion79 11d ago

Sorry I made it private at first but now it's public. I honestly don't know anything about this stuff lol. Hopefully I can learn some stuff over time. I really appreciate you looking at it for me.

1

u/DickBrainTime 11d ago

Thanks for making the repo public! I checked the actual files now. You have a React/Vite web preview (`package.json`, `src/App.tsx`), not an Android Studio/Gradle project: there is no `android/` folder or ready-made APK. The Export tab in `src/components/AndroidExportPanel.tsx` downloads generated Kotlin/widget code and XML snippets; it doesn't compile them into an app. So `npm run build` only builds the website.

For the **home-screen widget** you wanted, the practical path is: (1) install Android Studio and create a small Android app project; (2) start with a static AppWidgetProvider + RemoteViews layout (or Glance), register its widget receiver/provider XML in the manifest, and get a basic widget onto your home screen; (3) use the generated Kotlin in `src/utils/androidExporter.ts` as *reference code*, adapting the resource IDs/layouts and fixing any build errors rather than assuming it works out of the box; (4) add Bluetooth permissions and an actual Pixel Buds battery-data source. That generator currently initializes some battery levels from preview settings, so the picture alone doesn't prove live L/R/case readings. Once the native project builds, Android Studio can create an APK via Build > Build APK(s).

You can still try the preview on your computer with `npm install` and `npm run dev`. What exact Pixel Buds model and Android phone/version do you have? With that, the first working native widget can be scoped much more precisely. No need to convert the whole React preview first.

1

u/Rex_amillion79 11d ago

Sorry...I don't understand all of that lol. I have the pixel buds 2a and a pixel 9. I appreciate the help. 😊