NativeScript / nativescript-cli

Command-line interface for building NativeScript apps
https://www.npmjs.com/package/nativescript
Apache License 2.0
1.04k stars 195 forks source link

Android 64 bit Support needs to be enabled by default #4330

Closed NathanaelA closed 5 years ago

NathanaelA commented 5 years ago

Describe the issue By August 1st, Google will require apps to have 64 bit support enabled in addition to the 32 bit support.

Because the actual nativescript runtimes are native code (i.e. c/c++) this is a requirement we have to do, so getting this re-enabled by default; sooner than later will simplify everyone's life before the Aug 1st deadline.

Additional context The 64 bit runtimes are shipped, but in the past were disabled by default to keep the .apk size smaller.
Indirectly related to #1392

AppsByFen commented 5 years ago

I ended up excluding the whole x86 architecture and using only the arm the same way @kzimny did, and I lost only 5 devices that needed it anyway, so it's not a big loss at all :)

NathanaelA commented 5 years ago

@FanniPutnoczki - Just a FYI; those 5 devices probably include a several ASUS phones where are very popular in some areas. So once NS fixes the issue; I would highly recommend you do release a version for the x86 market... :D

edrick27 commented 5 years ago

image

I have the same problema. but if excluding the whole x86 architecture, How to know if I'm going to lose many devices?? 😢

n0mer commented 5 years ago

@kzimny just FYI - confirm that your config worked, thank you.

Stats before fix:

image

Stats for 'armeabi-v7a', 'arm64-v8a' only (looks like this is related to higher android SDK versions) : image

Also, quote from https://developer.android.com/distribute/best-practices/develop/64-bit#multi-apk-compliance :

If one of your APKs is marked as not being compliant, but is older and it’s not possible to bring it into compliance, one strategy is to add a maxSdkVersion="27" attribute in the uses-sdk element in that APK’s manifest. This APK won’t be delivered to devices running Android 9 Pie or later, and it will no longer block compliance

If maxSdkVersion in AndroidManifest.xml is honored by {N}/webpack build (in the light of https://github.com/NativeScript/android-runtime/issues/575), then this can serve as another work-around.

rosen-vladimirov commented 5 years ago

Hey everyone, It looks like Google have changed the requirements in the last few days - we've verified we can publish applications with 'armeabi-v7a', 'arm64-v8a', 'x86' architectures around August 1st (when the requirement was set) and we did not have any troubles. But it turns out something is changed now.

Due to the change in the requirements we are preparing a patch release for Android runtime (tns-android) that will include x86_64 architecture as well. Stay tuned for more information and thank you all for sharing the details about the errors.

n0mer commented 5 years ago

Just in case - one more thing.

image

For local debug purposes in Android emulator, only arm AVDs can be used when building for 'armeabi-v7a', 'arm64-v8a'. For now, android studio provides arm AVDs up to android 7.1.1. So, no android 8 or 8, and they are lack Intel's HAXM h/w acceleration: https://developer.android.com/studio/run/emulator-acceleration

Hope this helps :)

Roar1827 commented 5 years ago

@rosen-vladimirov looks like you made some big progress on this today- any guesses at when this issue will be resolved? Thank you very much for your efforts, we greatly appreciate them!

n0mer commented 5 years ago

@Roar1827 this might help for now: https://github.com/NativeScript/NativeScript/issues/7705#issuecomment-523363425

Roar1827 commented 5 years ago

Thanks @n0mer . We were able to get a build up using that. Looks like we've run into some Android compatibility warnings in the Pre-launch report- not sure how serious they are, but we will do some testing. Thank you for your help!

rosen-vladimirov commented 5 years ago

Hey everyone, As you've noticed - we've made a significant progress on this issue and we expect to release a patch version tomorrow (August 22nd) in case our tests show everything is working as expected. Meanwhile, in case you have some urgent release, you can use the rc versions of nativescript-dev-webpack and tns-android packages. I.e.:

rm -rf platforms
npm i --save-dev nativescript-dev-webpack@rc
tns platform add android@rc
tns build android --release --env.snapshot...

Stay tuned for more information, hopefully we'll be able to release a fix as planned.

vinita1505 commented 5 years ago

Hi everyone,

If project doesn’t contain any native library or I can say when I analyze the apk I dint got any .so file. So Is my apk or an app is compatible for 64 bit?

felixkrautschuk commented 5 years ago

@vinita1505 All NativeScript apps for Android are shipped with the V8 JavaScript-engine, which is native code, so any NativeScript developer is affected by this issue.

But the NS team has just released tns-android 6.0.2, so update your project and you should be safe now.

jnorkus commented 5 years ago

But the NS team has just released tns-android 6.0.2, so update your project and you should be safe now.

Is it safe to upgrade platform modules without upgrading to NS6?

felixkrautschuk commented 5 years ago

@jnorkus no, you have to migrate your project to NS 6 to be able to use the latest Android runtime for your app.

rosen-vladimirov commented 5 years ago

Hey everyone, We've just released tns-android 6.0.2 and nativescript-dev-webpack 1.1.1. You need to update both of them (and you need to target NativeScript 6):

rm -rf platforms
npm i --save-dev nativescript-dev-webpack@1.1.1
tns platform add android@6.0.2
tns build android --release --env.snapshot..
jnorkus commented 5 years ago

Is there any workaround for NS5 users that includes x86 support? Many plugins out there don't support NS6 and most of us are stuck with that.

etabakov commented 5 years ago

@jnorkus we don't plan to bakport this fix to older version as it is not a trivial amount of work. We would rather put effort to support the users in migrating to 6.0. Can you send us a summary of the plugins that incompatible, so that we can try to help where we can? Does this approach sound reasonable to you?

jnorkus commented 5 years ago

@etabakov I can totally understand the reasoning. To be honest I haven't even tried migrating yet. I am assuming it won't work because of the AndroidX breaking change. Once I have time to look into migration I will report my progress.

For the time being I will just exclude x86 support for our apps.

mtenus commented 5 years ago

Just uploaded new version to google play with config recommended by @dmdnkv. I miss only five devices if x86 and x86_64 is removed, all of them are wearable devices (watches) which are not relevant for me. Thanks!

@kzimny You need those (x86 and x86_64) mainly to test in emulators

NathanaelA commented 5 years ago

@marast78 If you are continuing to use NS 4/5 -- (Again this is NOT needed anymore with 6.02+)

android {
  defaultConfig {
    generatedDensities = []
    ndk {
      abiFilters.clear()
      abiFilters.addAll(['armeabi-v7a','arm64-v8a'])
    }
  }    
  buildTypes {
    debug {
      ndk {
        abiFilters 'x86'
      }
    }
  }
  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
}

This will disable x86 for release builds; but enable x86 for debug builds --- Thanks to Peter Staev who posted it in slack...

mtenus commented 5 years ago

@NathanaelA awesome tip :+1: thanks @PeterStaev

skillbrighterinfotech commented 5 years ago

I just built an app with ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86', exported as .aab. and uploaded it to the Play Store just fine, no complaints about missing 64-bit binaries.

My assumption is that Google does not require x86_64 binaries at all (and if the app is really running on a x86_64 target, e.g. tablet. then the x86 32-bit binaries will be used)

I have do this but not work same issue

skillbrighterinfotech commented 5 years ago

I added this to my app.gradle and it worked fine.

defaultConfig {
       ......
       ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}

Not work , please help me

Clifte commented 5 years ago

Same problem here. added but in bundle file the x86_64 is missing:

'defaultConfig' {
       ......
       ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
}
n0mer commented 5 years ago

@Clifte please try "clear" first

        ndk.abiFilters.clear()
        ndk.abiFilters.addAll([ 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'])
sebj54 commented 5 years ago

@NathanaelA Thank you for the snippet! I also wanted to clarify, the minSdkVersion is not mandatory. I removed it because I still have users with Android < 6 and I was able to publish on Google Play 👌

nudiref commented 5 years ago

hello all,

what worked for me in the end was the following configuration:

android { defaultConfig { ........ ndk { abiFilters.clear() abiFilters.addAll(['armeabi-v7a', 'x86','x86_64']) } ....... } }

i would love to know what is wrong with 'arm64-v8a' package and be able to include it.

Izrab commented 5 years ago

I use NativeScript 6.1 Do I need to do anything regarding the 64-bit requirement issue?

sebj54 commented 5 years ago

I have NS 6.1.2 on a fresh new project and I still cannot upload an aab file to Google Play.

The bundle has been generated with this command:

tns build android --bundle --release --key-store-path upload-key.keystore --key-store-password *** --key-store-alias upload-key --key-store-alias-password *** --aab

Here is my app.gradle:

// Add your native dependencies here:

android {
  defaultConfig {
    generatedDensities = []
    applicationId = "com.example.app"
  }
  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
}

What did I miss?

racknoris commented 5 years ago

@sebj54 Did you manage to solve this?

sebj54 commented 5 years ago

@racknoris I'm still using this suggestion: https://github.com/NativeScript/nativescript-cli/issues/4330#issuecomment-523993414, even with NS 6

racknoris commented 5 years ago

@sebj54 I see, thank you

Fatme commented 5 years ago

@sebj54,

It should be enough just executing the command you mentioned:

tns build android --bundle --release --key-store-path upload-key.keystore --key-store-password *** --key-store-alias upload-key --key-store-alias-password *** --aa

No additional actions are required.

However, fell free to open an another issue with detailed description and exact error you received when trying to upload an aab file to Google Play.