Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Wear generate two apk

I just created my first android wear app. I have two modules, mobile and wear. I have on my mobile module a dependency that points to the wear module as described on the documentation. When I generate the apk I end up with two apks, one called mobile and one called wear. Should I just ignore the wear apk or did I not do something right? I think that there should only be one apk.

like image 547
Chrystian Avatar asked Jul 06 '14 20:07

Chrystian


People also ask

How you will create generate multiple APK in a package?

To configure your build for multiple APKs, add a splits block to your module-level build. gradle file. Within the splits block, provide a density block that specifies how Gradle should generate per-density APKs, or an abi block that specifies how Gradle should generate per-ABI APKs.

What is APK split?

Apk splits allow app developers to divide (split) their apks across device densities and Application Binary Interfaces (ABIs). These separate apks are uploaded to Google play store and users only get to download the right and optimized apks for their device.

What is APK injection?

APK injector will use the Apktool in order to fully decompile the application, inject the payload and then compile it again and sign it. APK Injector – Decoding the APK. Then APK Injector will attempt to inject the payload inside a file and use again Apktool to compile and sign the application.


2 Answers

There are two apks because (for debugging/testing) you can (and should) install the wear apk directy on the Android Wear device.

However, when you are going to publish the "Android Wear-ready" app to the Play Store, you should only upload the mobile apk. The other apk is embedded within, and will be automatically pushed to the connected watch.

See Install the Wearable app in the documentation:

When developing, you install apps directly to the wearable like with handheld apps. Use either adb install or the Play button on Android Studio.

When you're ready to publish your app to users, you embed the wearable app inside of the handheld app. When users install the handheld app from Google Play, a connected wearable automatically receives the wearable app.

Note: The automatic installation of wearable apps does not work when you are signing apps with a debug key and only works with release keys. See Packaging Wearable Apps for complete information on how to properly package wearable apps.

like image 120
matiash Avatar answered Sep 19 '22 17:09

matiash


Two APKs is exactly what is expected: the wear APK is then embedded into the mobile APK as per the packaging Wear apps training. In release builds, the wear APK is then auto-installed onto the user's Android Wear device. However, as per the note on the packaging page:

This feature doesn't work when you are signing your apps with a debug key when developing. While developing, installing apps with adb install or Android Studio directly to the wearable is required.

like image 33
ianhanniballake Avatar answered Sep 20 '22 17:09

ianhanniballake