Nativescript: Add x86_64 libNativeScript.so for Android - android

I have Nativescript-vue project.
Because of Google play 64-bit requirement I am trying to add x86_64 native code.
All resources I found while researching say to do this:
In app/App_Resources/Android/app.gradle file:
android {
defaultConfig {
generatedDensities = []
applicationId = "com.foo.bar"
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86', 'x86_64'
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
But 'x86_64' is ignored the output apk's lib folder contains only this platforms 'armeabi-v7a', 'arm64-v8a', 'x86'.
I found also this github issue , Nativescript team was saying that in the next release the 'x86_64' platform will be added, So i upgraded {N} , but there was no difference.
Also tried "ABI Split" config, that I found on the official {N} documentation & added 'x86_64' to be included:
android {
....
defaultConfig {
....
ndk {
abiFilters.clear()
}
}
splits {
abi {
enable true //enables the ABIs split mechanism
reset() //reset the list of ABIs to be included to an empty string
include 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
universalApk true
}
}
}
But also no difference.
Is there any way to achieve this manually?
Also any suggest, info, documentation will be helpful.
My config:
minSdkVersion="21"
targetSdkVersion="28"
Tried with "tns-android" version "5.3.1" & "6.0.0"
If you need anything else from my project/config... Tell me in the comments.

Android runtime v6.0.2 with support for 64bit is already out, the migrate command may not take you to the latest version of of tns-android always but a recent version.
You may manually update the version on package.json or removing and adding the platform back via CLI will take you to most latest version of the runtime.

Related

Why I'm getting "This app is incompatible with your device for all devices" on Google Play Store

We have android app which is giving This app is incompatible with your device. for all devices which are trying to access the app listing on Google Play Store.
While Developing The app is working and can be installed freely on any device but from play store it is not getting installed.
Attaching gradle file where I feel the error is coming!
splits {
abi {
enable true
reset()
include 'arm64-v8a', 'armeabi-v7a' // i believe this is this the issue (before judging please read the p.s)
universalApk true
}
}
defaultConfig {
applicationId ""
minSdkVersion
targetSdkVersion
versionCode 1
versionName "1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters 'x86_64','arm64-v8a', 'armeabi-v7a' // i believe this is this the issue (before judging please read the p.s)
}
}
When I created the apk, I'm getting just one APK which i'm uploading to the google play console
Phones used while development Xiaomi and Samsung and all of them have Android Version 8, 9, 10
P.s I'm a fullstack developer, my company has given me responsibility of managing android app development also, now developers are developing the application under me, and i'm just responsible for releasing the application to play store. And when I asked them, they are not aware of this issue as they are freshers
Simple Solutions, I don't remember how I came to this conclusion
In the manifest file, inside defaultConfig object and inside ndk, I added 'x86' which fixed the issue and now app is compatible with devices
defaultConfig {
applicationId ""
minSdkVersion
targetSdkVersion
versionCode 1
versionName "1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
// ***************** check this line for the answer *****************
abiFilters 'x86_64','arm64-v8a', 'armeabi-v7a', 'x86' // <------ Added 'x86'
// ***************** check the above line for answer ****************
}
}

app bundle default language is not system language

My project is an application that supports In-App Language Switching. The app bundle I packaged can be installed directly through the bundletool tool to correctly display the language set by the system, and the apk directly installed can also display the language set by the system correctly, but when I download from Google When play downloads my app (app bundle uploaded by google play), my app does not display the language set by the system, but the language corresponding to my country. All installation methods can be in the app after installation Switch language normally, how should I solve this problem。
my gradle config:
android {
defaultConfig {
...
multiDexEnabled true
...
ndk {
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
}
resConfigs "en-rUS", "zh-rCN", "zh-rTW"
}
bundle{
language{
enableSplit false
}
}
}
This problem has been solved. The reason is that the allowBackup attribute is configured as true in the Application attribute in the AndroidMainfest file. Change it to false. In the case of true, google service will back up the app configuration file, but I don’t know exactly what files to back up and how the backup is done. In addition, based on the problems I encountered in the process of using multiple languages, some tips for switching between multiple languages in the app are given.
Tip 1: For androidx.appcompat.appcompat dependency, it is best to use version 1.0.2, other versions will cause the in-app switching of multiple languages on some phones
Tip 2: bundle{
language{
enableSplit false
}
}
If you need to switch multiple languages in the app, it is recommended to change this attribute to false, only for bundle packages.
Tip 3: Remember to configure
resConfigs "ms-rMY", "zh-rCN", "zh-rTW"
Otherwise, multi-language resources may not be packaged in the apk when packaging
Finally, my build.gradle configuration file
android{
defaultConfig{
bundle{
language{
enableSplit false
}
}
resConfigs "ms-rMY", "zh-rCN", "zh-rTW"
}
}
dependencies{
implementation group: 'androidx.appcompat', name: 'appcompat', version: "1.0.2"
}

ABI filters of extended Build Variants do not overrides its parents

In a project i need specific ABI filters per release and debug and some extneded build variants. It is ok and works fine with debug and release.
release {
.
.
.
ndk {
abiFilters 'armeabi'
}
}
debug {
.
.
.
ndk {
abiFilters 'x86', 'x86_64', 'armeabi'
}
}
When i extend new buildvariant that init each of these tow variants, abifilters is remained and do not change. For example i have debug_on_mainserver that inits debug. but i want to add another abiFilter. But it is still use debug abiFilters.
debug_on_mainserver {
initWith(buildTypes.debug)
.
.
.
ndk {
abiFilters 'armeabi'
}
}
I should say that may i can achive this with Flavor but i use 3 flavor for another reason (store type and handle store config and variables) and i do not want to add another flavor and mulitple my buildVariants variety. Beacuse it is logically should include in debug_on_mainserver.
How i can exclude or remove base abiFilters and add new one? Or is it another way to achive this?

Gradle dependency for specific architecture with ABI splits

Im facing this problem which seems im not able to solve. Here is scenario:
Im building apk which uses gradle dependency and this dependency is architecture specific so for apk for x86 i need different dependency and for arm different as well.
I solved it with product flavors:
productFlavors {
dev { ... }
develx86 { ... }
production { ... }
productionx86 { ... }
}
So then i defined dependency like this:
develCompile 'dependency_for_arm'
develx86Compile 'dependency_for_x86'
This works good. But recently i had to add to my application an usage of renderscript. I did it in this way:
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
And after this when i uploaded apk on Google Play it says it's apk is suitable with arm, x86. I don't know how this is possible. As you can think it will crash on device with different CPU (if i generated apk for arm and user will execute it on x86 app will crash).
So i decited to use ABI splits:
splits {
abi {
enable true
reset()
include 'armeabi', 'x86'
universalApk false
}
}
//Ensures architecture specific APKs have a higher version code
//(otherwise an x86 build would end up using the arm build, which x86 devices can run)
ext.versionCodes = [armeabi:0, x86:1]
import com.android.build.OutputFile
android.applicationVariants.all { variant ->
// assign different version code for each output
variant.outputs.each { output ->
int abiVersionCode = project.ext.versionCodes.get(output.getFilter(OutputFile.ABI)) ?: 0
output.versionCodeOverride = android.defaultConfig.versionCode + abiVersionCode
}
But now when i see generated apk files, my dependency which is flavor-specific is not included into apk and apk will crash when i open section which uses API from this dependency.
Do someone know how to solve this issue? Or someone know why Google Play says that apk is for both architectures when i included renderscript? (Without it it works properly but i need renderscript).
Thank you for your time. I will appreciate any help.
If you look inside your APK, under lib folder, you should see that renderscript support mode added libs for other architectures than the one you're supporting.
You can keep your earlier configuration with ABI-specific flavors.
But in order to ensure that no libs for other architectures are included, try adding abiFilters to your flavors:
productFlavors {
dev { ... ndk.abiFilters 'armeabi-v7a' }
develx86 { ... ndk.abiFilters 'x86' }
production { ... ndk.abiFilters 'armeabi-v7a' }
productionx86 { ... ndk.abiFilters 'x86' }
}
Sorry I cannot comment inline yet.
What's in the apk, especially in res/raw/ and lib/?
Also, are you using gradle-plugin 2.1.0? (since you are using renderscriptTargetApi 22), have you tried Build-Tools 23.0.3?

Android product flavors are not considered when using CPU ABI split in build.gradle

I want to make APK split based on CPU ABI according to http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits, however I want to split the APK only for a certain product flavor.
So my build.gradle file has the following product flavors plain and market. Actually I want the APK split to be performed when building market flavor.
android {
productFlavors {
plain {
}
market {
splits {
abi {
enable true
reset()
include 'armeabi', 'armeabi-v7a', 'x86', 'mips'
universalApk true
}
}
}
}
}
However, when I invoke gradle assemblePlainDebug and assembleMarketDebug, both of them produces the multiple APK. Is there something wrong with the configuration above?
I'm using com.android.tools.build:gradle:1.2.3.
I've been looking for a way to do this for a while and haven't found a solid solution. Something to do with the splits having to be run before resolving the buildTypes and productFlavors.
The Android Gradle - is use splits only for release possible? question had answer that I thought useful. It basically relies on a project property, passed in when building via the command line or continuous integration invironment, to set weather the split apk's option is enabled or not.
I used it like this:
splits {
abi {
enable project.hasProperty('splitApk')
reset()
include 'x86', 'armeabi-v7a', 'mips', 'armeabi'
universalApk true
}
}
and then depending on what falvour or build type you are building you can include:
./gradlew --project-prop splitApk assembleMarketDebug
This should then only enable the apk split when explicitly told too and should stay disabled for everything else.

Categories

Resources