Wear App and with custom build type with applicationIdSuffix

后端 未结 4 2006
天命终不由人
天命终不由人 2020-12-15 04:53

I have an app where I\'d like to add an Android Wear app extension. The main app has three build types (debug, beta and release). Beta builds have an applicationIdSuff

4条回答
  •  不知归路
    2020-12-15 05:16

    Don't worry, you CAN do what you want to do. I just did it for the enterprise app I work on.

    The key is NOT to use wearApp project(':wear'), since that only works when you have the same applicationId in your wear app as your main app. And let's face it, how often in real life does that situation happen? If it happens, you probably aren't using Gradle to the best of it's ability.

    You want to follow the instructions for Package Manually in the google wear docs https://developer.android.com/training/wearables/apps/packaging.html#PackageManually

    Unfortunately, this will require you to build your wear app with the same applicationId as the particular build variant you are making at the time, but it does allow you to successfully package the wear app inside an app with multiple applicationId.

    Also, one trick I do that helps is to not put the wear apk inside /res/raw, but in /assets, that way you don't have to deal with Andriod Studio compressing the apk.

    Hope this helps! Drove me crazy for a couple days finding a solution. And the only tutorial out there is in French, and I had to translate the website to read it! https://translate.google.com/translate?hl=en&sl=auto&tl=en&u=http%3A%2F%2Fblog.octo.com%2Fpackager-une-application-android-wear-dans-la-vraie-vie%2F

提交回复
热议问题