问题
UPDATE: tried lowering "v7a" ABI versionCode to prefix 4 (lower than 5 which is "v8") without any luck
Currently my app is in Alpha stage. Every APK was generated by the same ABI split and the same version multiplication for each ABI (code included), to both "armeabi-v7a", and to "arm64-v8a". Even though I have uploaded only "v8a" APK until now. Now when I'm trying to upload the "v7a" I'm getting the following error from google play console:
Problem: This APK will not be served to any users because it is completely shadowed by one or more APKs with higher version codes. Resolution: Remove this APK from your release or review the targeting and version codes of the APKs that you are including in this release.
android {
compileSdkVersion 26
buildToolsVersion '28.0.3'
defaultConfig {
multiDexEnabled true
minSdkVersion 21
versionCode 28
versionName "1.36"
targetSdkVersion 26
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
if (nativeBuildSystem == 'cmake') {
externalNativeBuild {
cmake {
arguments '-DANDROID_TOOLCHAIN=gcc', '-DANDROID_STL=gnustl_static'
}
}
}
}
if (nativeBuildSystem == 'cmake') {
externalNativeBuild {
cmake {
path './jni/CMakeLists.txt'
}
}
}
// special for TFLite without it we will get an error when trying
// to use 'detect.tflite' assets file
aaptOptions {
noCompress "tflite"
}
splits {
abi {
enable true
reset()
include "armeabi-v7a", "arm64-v8a"
universalApk false
}
}
lintOptions {
abortOnError false
}
sourceSets {
main {
if (nativeBuildSystem == 'bazel' || nativeBuildSystem == 'makefile') {
// TensorFlow Java API sources.
java {
srcDir '../../java/src/main/java'
exclude '**/examples/**'
}
// Android TensorFlow wrappers, etc.
java {
srcDir '../../contrib/android/java'
}
}
// Android demo app sources.
java {
srcDir 'src'
}
manifest.srcFile 'AndroidManifest.xml'
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = [project.ext.ASSET_DIR]
}
androidTest {
java.srcDirs = ['src/androidTest/java', 'src']
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
Version code separation:
ext.versionCodes = ['arm64-v8a': 5, 'armeabi-v7a': 6]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
def abiFilter = output.getFilter(OutputFile.ABI)
def abiMultiplier = 0
if (abiFilter != null) {
abiMultiplier = (int) project.ext.versionCodes.get(abiFilter)
}
output.versionCodeOverride = (int) abiMultiplier * 1000 + (int) android.defaultConfig.versionCode
}
}
Also attached screenshots from play console. It seems that the version of "v7a" APK is shadowing the "v8" as if the play console doesn't seem to differentiate the architectures between them. This hypothesis is also supported by the fact that the description of every APK both say that APK supports both of the platforms.
回答1:
The versionCode of the arm64-v8a APK should be higher than the versionCode of the armeavi-v7a APK.
To determine which APK is served, Play picks the highest versionCode that is a compatible with the given device. Because all devices supporting 64 bits (arm64-v8a) also support 32 bits (armeabi-v7a), if you put the 32-bit APK with a higher versionCode, it will also match for 64-bits devices and thus that one will be served instead of the 64-bits one. That's why Play tells you that the arm64-v8a is shadowed.
Hope that helps.
回答2:
As Pierre suggested, each of the APKs (v7a, v8) contained both of the ABIs. But how could that happen you ask?
Due to JavaCV (OpenCV libraries) Gradle dependencies for both ABIs in one module:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
api (group: 'org.bytedeco', name: 'javacv', version: '1.4.3', {
exclude group: 'org.bytedeco.javacpp-presets', module: 'flandmark'
exclude group: 'org.bytedeco.javacpp-presets', module: 'flycapture'
exclude group: 'org.bytedeco.javacpp-presets', module: 'leptonica'
exclude group: 'org.bytedeco.javacpp-presets', module: 'libdc1394'
exclude group: 'org.bytedeco.javacpp-presets', module: 'libfreenect2'
exclude group: 'org.bytedeco.javacpp-presets', module: 'libfreenect'
exclude group: 'org.bytedeco.javacpp-presets', module: 'librealsense'
exclude group: 'org.bytedeco.javacpp-presets', module: 'tesseract'
exclude group: 'org.bytedeco.javacpp-presets', module: 'videoinput'
exclude group: 'org.bytedeco.javacpp-presets', module: 'artoolkitplus'
})
// add the libraries you need depending on your mobile phone - if you get an exception or
// "... class not found", or "didn't load library ...", try replace android-arm64 with android-arm, or with android-x86
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: 'android-arm'
implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: 'android-arm64'
}
I commented out implementation group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.3-1.4.3', classifier: 'android-arm64'
, re uploaded and it worked. arm64 supports arm, but not the other way around.
来源:https://stackoverflow.com/questions/56245891/apk-completely-shadowed-with-multiple-abi-apks