我也尝试切换到推荐的JRE,也尝试了几个有关文件创建的APK命名策略,例如将输出移动到不同的目录或不使用文件构造函数。
我的 build.gradle
看起来像这样:
defaultConfig {
applicationIdcom.chiskosystems.brokr
versionCode versionNumber
versionName$ {versionMajor}。$ {versionMinor}。$ {versionPatch} ($ {versionBuild})Release
minSdkVersion 16
targetSdkVersion 25
testInstrumentationRunnerandroid.support.test.runner.AndroidJUnitRunner
multiDex启用true
jackOptions {
启用false
}
vectorDrawables {
useSupportLibrary true
}
}
split {
abi {
enable true
reset()
包括'armeabi','armeabi-v7a','arm64-v8a'
project.ext.versionCodes = ['armeabi':1,'armeabi-v7a':2,'arm64-v8a':3]
applicationVariants.all {variant - >
variant.outputs.each {输出 - >
def fileNaming =apk / brokr
def outputFile = output.outputFile
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(
com.android.build.OutputFile.ABI),0)* 10000000 + android.defaultConfig.versionCode
}
}
signConfigs {
release {
try {
storeFile文件('../ mystore.jks')
keyAlias'release'
storePassword KEYSTORE_PASSWORD
keyPassword KEY_PASSWORD
} catch(ex){
throw new InvalidUserDataException(您应该在gradle.properties中定义KEYSTORE_PASSWORD和KEY_PASSWORD。)
}
}
}
dataBinding {
enabled true
}
dexOptions {
javaMaxHeapSize3g
preDexLibraries false
}
buildTypes {
release {
minify启用假
proguardFile'path / proguard-project.pro'
...
buildConfigFieldString,SERVER,'https://myfirebaseserver.com'
debuggable false
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
applicationIdSuffix.debug
versionNameSuffix-debug
buildConfigFieldString,SERVER,https://myfirebaseserver.com'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion .VERSION_1_8
}
productFlavors {
sandbox {
buildConfigFieldString,'PAYPAL_ENV','PayPalConfiguration.ENVIRONMENT_NO_NETWORK'
}
full {
buildConfigFieldString,PAYPAL_ENV,PayPalConfiguration.ENVIRONMENT_PRODUCTION'
signingConfig signingConfigs.release
targetSdkVersion 25
}
}
发生在Win和Unix系统上。我花了整整一天的时间修改脚本,但没有成功,我现在无能为力。
的任何想法都是继续?
解决方案
原因是依赖关系:
compile'com.lambdaworks:scrypt:1.4.0'
显然自动抓住我的笔记本电脑的架构,并在那里粘着那个旗帜。
So this is happening. No matter what I try doing on the build.gradle, all APK are coming out with native_code = 'x86_64'
flag, so when I deploy the app to the store the result is having +15K uncompatible devices, and only 19 compatible. I first thought that, somehow, having NDK installed was the reason, or my modified build script. But it still happens when I go through the Generate Signed APK wizard. The splits
block was also originally missing, and didn't help. The weirdest thing is that when I install via a console push, IT WORKS!
I also tried switching to the recommended JRE, also several APK naming strategies regarding file creation, like moving the output to different directories or not using the file constructor.
My build.gradle
looks like this:
defaultConfig {
applicationId "com.chiskosystems.brokr"
versionCode versionNumber
versionName "${versionMajor}.${versionMinor}.${versionPatch} (${versionBuild}) Release"
minSdkVersion 16
targetSdkVersion 25
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
jackOptions {
enabled false
}
vectorDrawables {
useSupportLibrary true
}
}
splits {
abi {
enable true
reset()
include 'armeabi', 'armeabi-v7a', 'arm64-v8a'
}
}
project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3]
applicationVariants.all { variant ->
variant.outputs.each { output ->
def fileNaming = "apk/brokr"
def outputFile = output.outputFile
output.versionCodeOverride =
project.ext.versionCodes.get(output.getFilter(
com.android.build.OutputFile.ABI), 0) * 10000000 + android.defaultConfig.versionCode
}
}
signingConfigs {
release {
try {
storeFile file('../mystore.jks')
keyAlias 'release'
storePassword KEYSTORE_PASSWORD
keyPassword KEY_PASSWORD
} catch (ex) {
throw new InvalidUserDataException("You should define KEYSTORE_PASSWORD and KEY_PASSWORD in gradle.properties.")
}
}
}
dataBinding {
enabled true
}
dexOptions {
javaMaxHeapSize "3g"
preDexLibraries false
}
buildTypes {
release {
minifyEnabled false
proguardFile 'path/proguard-project.pro'
...
buildConfigField "String", 'SERVER', '"https://myfirebaseserver.com"'
debuggable false
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
buildConfigField "String", 'SERVER', '"https://myfirebaseserver.com"'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
productFlavors {
sandbox {
buildConfigField "String", 'PAYPAL_ENV', '"PayPalConfiguration.ENVIRONMENT_NO_NETWORK"'
}
full {
buildConfigField "String", 'PAYPAL_ENV', '"PayPalConfiguration.ENVIRONMENT_PRODUCTION"'
signingConfig signingConfigs.release
targetSdkVersion 25
}
}
Happening on both Win and Unix systems. I've spent the whole day modifiyng the script without success and I'm helpless at this point.
Any ideas of what the bleep is going on? Thanks a lot!
解决方案
The cause was a dependency:
compile 'com.lambdaworks:scrypt:1.4.0'
apparently automatically grabbing my laptop's architecture and sticking that flag in there.
这篇关于无论如何,Android构建工具只构建x86_64。 APK通过adb安装,但在Play商店中显示为不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!