问题
I'm trying to upload into develop my Instant App with Google Play Console, but it returns an error: Package name of your Instant App APKs should be the same as your app's package name.
I have a feature call base, the apk and the instantApp feature too, everyone has its own gradle file and the apk and the instantApp implements the base feature:
dependencies {
implementation project(':base')
}
I try to publish the .apk building by Build/Generate signed APK... with the same key of the installable App and it creates a file .apk compressed on zip
I don't know what happends cause the instantApp and the apk modules uses the same base feature and I don't find how I have to build the instant App APK
回答1:
That zip file is the instant app. It can contain multiple APKs, one for each feature module, one for the base, and potentially some configuration APKs. It's ok if it only contains one APK. That will be the base.
Each of the APKs in the zip will have an AndroidManifest.xml, which you can view easily using APK Analyzer. They should each have a packageName, and they should all match, and that value is the package name of the instant app.
The installed app's package name is in the usual place, in that APK's AndroidManifest.xml.
The samples demonstrate the recommended way to structure your project, and that will produce and instant and an installed app with the same package name.
回答2:
Check if your base module has a reference to the application module:
Like:
dependencies {
application project(":installed")
feature project(':app')
feature project(":lite")
}
As stated in the docs:
By setting this dependency, the app's applicationId for each flavor is appplied to the base feature module, which in turn propagates to all of the features in the project. This expression ensures that the installable APK and Instant App APKs have the same applicationId. If this is not set, the applicationId defaults back to the one defined in the base feature module manifest.
来源:https://stackoverflow.com/questions/47540528/google-play-console-package-name-of-your-instant-app-apks-should-be-the-same-as