I just started deploying my first beta app to Google's Play Console developer site. My initial APK uploaded fine but I need to support multiple environments so I am trying to implement build variants.
I understand the difference between PackageName and ApplicationId thanks to this url: http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename and I've implemented my AndroidManifest.xml and build.gradle accordingly.
I can create a signed APK with ABI specific as well as universal but when I try to upload the same universal as I did prior I receive the error: "Your package name must be com.myapp"
This is the header in my AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.myapp">
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.myapp"
minSdkVersion 21
targetSdkVersion 22
versionName "12-APR-2016"
versionCode 12042016
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/NOTICE'
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
buildTypes {
debug {
buildConfigField "String", "SERVER_URL", "\"https://dev.myapp.com/?action=\""
applicationIdSuffix ".debug"
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
release {
buildConfigField "String", "SERVER_URL", "\"https://release.myapp.com/?action=\""
applicationIdSuffix ".release"
minifyEnabled = false
proguardFiles += file('proguard-rules.pro')
}
}
productFlavors {
x86 {
applicationId "com.myapp"
versionCode Integer.parseInt("6" + defaultConfig.versionCode)
ndk {
abiFilter "x86"
}
}
mips {
applicationId "com.myapp"
versionCode Integer.parseInt("4" + defaultConfig.versionCode)
ndk {
abiFilter "mips"
}
}
armv7 {
applicationId "com.myapp"
versionCode Integer.parseInt("2" + defaultConfig.versionCode)
ndk {
abiFilter "armeabi-v7a"
}
}
arm {
applicationId "com.myapp"
versionCode Integer.parseInt("1" + defaultConfig.versionCode)
ndk {
abiFilter "armeabi"
}
}
}
splits {
abi {
enable true // enable ABI split feature to create one APK per ABI
universalApk true //generate an additional APK that targets all the ABIs
}
}
// map for the version code
project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9]
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(com.android.build.OutputFile.ABI), 0) * 1000000 + android.defaultConfig.versionCode
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'com.android.support', name: 'appcompat-v7', version: '23+'
//omitted for brevity
}
I've followed the link and specified the PackageName and ApplicationId in the appropriate sections AndroidManifest.xml and build.gradle (defaultConfig and ProductFlavors).
Any ideas as to why the packageName is not recognized or how I can test the APK (i.e. command line, validator, etc.)
Regards, -J