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

rosen-vladimirov commented 5 years ago

Hey @NathanaelA , Thanks for bringing the attention to this new requirement. We'll discuss it internally and come up with a suggestion how to support this. It looks like we'll have to enable builds for both armv7 and arm64 architectures by default. This will make the build slower, so we may enable it for release builds only. At the moment users can control the architectures from the app.gradle file in the project, but we may add some command line flag to make it easier. What do you think for all of these ideas?

NathanaelA commented 5 years ago

@rosen-vladimirov - I think enabling it only on release is the best idea. Adding flags would be useful for people wanting to test; but as long as we document how to change the app.gradle for debug builds I think your good. ;-)

brndusic 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'
}
racknoris commented 5 years ago

@brndusic Did you have any troubles in google play? Did the added 64 bit support affect any plugins?

@rosen-vladimirov Is this line what you were planning to add when using a flag?

brndusic commented 5 years ago

@racknoris I haven't noticed any problem. Warning on google play went away after I built this way.

nlmunro commented 5 years ago

I can confirm this solved it for me - using geolocation, firebase, localstorage and som UI plugins.

racknoris commented 5 years ago

@brndusic It seems that this is the official way to do it, does it do the same as your way?

android {
....
  defaultConfig {
    ....
    ndk {
      abiFilters.clear()
    }
  }
....
lambourn commented 5 years ago

Maybe I'm missing something here - I just built the Android version of our app and set the app.gradle as suggested by @brndusic

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

however, running APK Analyze from Android studio I do not see libNativeScript.so for x86_64:

apk-analyzer

racknoris commented 5 years ago

@lambourn could you please try in the way I found as well? perhaps it'll work

lambourn commented 5 years ago

@racknoris I did. Same result.

brndusic commented 5 years ago

@racknoris I have not analyzed .apk file, the thing it solved for me is that there is no more warning on app store about 64 bit support.

lambourn commented 5 years ago

@brndusic good to know. Maybe the Play Store is fine with just the arm64 binaries being present as x86_64 is not a relevant platform for Android mobile phones / tablets?

ExaltedJim commented 5 years ago

I am experiencing a crash of my app on startup when running it on an Android emulator with the CPU set to x86_64. This is because libNativeScript.so is missing from lib/x86_64 folder of the apk (it is present for all other architectures - x86, arm64-v8a, armeabi-v7a). Is there a plan to have a x86_64 version of libNativeScript.so?

felixkrautschuk commented 5 years ago

@ExaltedJim , do you see any crash information in the logs?

romandrahan commented 5 years ago

@ExaltedJim, same for me: https://take.ms/I5EuD

kzimny commented 5 years ago

My app.gradle looks as follow:

android {
  defaultConfig {  
    generatedDensities = []
      applicationId = "com.aaaaa.nativeapp"
    ndk {
      abiFilters.clear()
    }
  }  
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }  
} 

.apk package contains lib\arm64-v8a; lib\armeabi-v7a and lib\x86 folders with libNativeScript.so library image

Where is the libs\x86_64 folder? Do I miss something or it is expected?

Update the app is running on an Android emulator with the CPU set to x86_64. Can someone explain why the app is running without libNativeScript.so library in x86_64 folder and why the folder has not been created? Thanks!

Serge-SDL commented 5 years ago

same problem here and the deadline to update app is august first!

dmdnkv commented 5 years ago

The same problem. It was decided to skip x86 platform support for our app as a workaround since almost 99% of mobile devices use ARM. The following config could help:

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

Supported count of devices was decreased by 6 from 10557 to 10551 (that was displayed in Google Console App releases section after the roll out with that configuration)

kzimny commented 5 years ago

Thanks @dmdnkv, indeed not many mobile devices runs on x86 or x86_64 architecture. Found an interesting description here. I'll try with 'armeabi-v7a' and 'arm64-v8a' CPU's only.

lambourn 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)

dmdnkv commented 5 years ago

@lambourn according to this guide Google provided https://developer.android.com/distribute/best-practices/develop/64-bit seems to be that x86_64 is required. There were no complaints about missing x86_64 in Google Console for app I am working on and it is possible to upload the APK without 64bit version but the warning came from Google by email that app doesn't meet the requirement.

image

I did send a message to google support with a question about whether it is fine to have ARM only and stop x86 support to meet the requirements, so hope I'll get the answer soon.

lambourn commented 5 years ago

@dmdnkv thanks for the heads-up.

I just checked the Android App Bundle report for the uploaded .aab. It turns out that we'd miss 49 device models in total if we remove x86_64 and x86 support for our app. Looks acceptable.

kzimny 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!

jeremypele commented 5 years ago

@rosen-vladimirov Do you guys plan to publish an official statement/blog post regarding this specific case? August 1st is in 2 weeks

ExaltedJim commented 5 years ago

@ExaltedJim , do you see any crash information in the logs?

@felix-idf sorry I have been busy as of late with other projects - when I find the time I will bring up my app in the 64 bit emulator again and report any crash logs.

Just to let others know, after compiling my app with 'armeabi-v7a', 'arm64-v8a', 'x86' ,'x86_64' enabled, I published the app to the store, and the previous warning I received from Google Play Store about lack of 64-bit support has gone away, however as I've demonstrated in the 64-bit emulator, it won't run.

dmdnkv commented 5 years ago

@ExaltedJim I had almost the same path, it was 32bit only, then I built with 'armeabi-v7a', 'arm64-v8a', 'x86' , 'x86_64' there were no warnings in the Google Console after upload it but then later after several weeks it was an email from Google on July 10th with a warning about the app didn't meet 64bit requirement.

Did you receive an email from Google?

nlmunro commented 5 years ago

I also got the warning email, despite adding the 64 bit options, so I did as others suggested and removed 'x86' , 'x86_64'. For me that only excluded Android Wear devices (which are not relevant to our app), so hopefully that will solve it...

On Fri, 12 Jul 2019 at 08:47, Konstantsin Demedenkov < notifications@github.com> wrote:

@ExaltedJim https://github.com/ExaltedJim I had almost the same path, it was 32bit only, then I built with 'armeabi-v7a', 'arm64-v8a', 'x86' , 'x86_64' there were no warnings in the Google Console after upload it but then later after several weeks it was an email from Google on July 10th with a warning about the app didn't meet 64bit requirement.

Did you receive an email from Google?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NativeScript/nativescript-cli/issues/4330?email_source=notifications&email_token=ABTQLUMUTPLGUX6QNZCUJODP7AZH3A5CNFSM4GTUM2M2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZY7UTY#issuecomment-510786127, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTQLUMSPGLAU75YHFQJRGLP7AZH3ANCNFSM4GTUM2MQ .

ExaltedJim commented 5 years ago

@ExaltedJim I had almost the same path, it was 32bit only, then I built with 'armeabi-v7a', 'arm64-v8a', 'x86' , 'x86_64' there were no warnings in the Google Console after upload it but then later after several weeks it was an email from Google on July 10th with a warning about the app didn't meet 64bit requirement.

Did you receive an email from Google?

@dmdnkv I received the email before attempting to add 64-bit support to my app. I have not received an email since uploading my updated app (though my production app is still 32-bit only, the newly uploaded one is still in internal testing).

I had a look at the details of my 32-bit production app and it says that the native platforms it supports are "armeabi-v7a" and "x86".

When I look at the updated app in internal testing is says that it supports "all native platforms", which is encouraging. Additionally when I click on the button "Explore App Bundle" I see ABIs for "arm64-v8a", "armeabi-v7a", "x86_64" and "x86".

@felix-idf - I just tried launching my app in debug mode on an Android x86_64 emulator and it crashes on starting up the app, with no information on why it is crashing. If you know where the logs might be I can grab them and display them here.

ExaltedJim commented 5 years ago

@ExaltedJim , do you see any crash information in the logs?

@felix-idf managed to work out how to get crash information, here is what I see in the logs:

2019-07-15 10:35:14.323 5826-5826/com.foo.Bar E/AndroidRuntime: FATAL EXCEPTION: main Process: com.foo.Bar, PID: 5826 java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.foo.Bar-aUeAJgf5iB2UWUve7p6oEQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.foo.Bar-aUeAJgf5iB2UWUve7p6oEQ==/lib/x86_64, /data/app/com.foo.Bar-aUeAJgf5iB2UWUve7p6oEQ==/base.apk!/lib/x86_64, /system/lib64]]] couldn't find "libNativeScript.so" at java.lang.Runtime.loadLibrary0(Runtime.java:1012) at java.lang.System.loadLibrary(System.java:1669) at com.tns.RuntimeHelper.initRuntime(RuntimeHelper.java:71) at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:19) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871) at android.app.ActivityThread.access$1100(ActivityThread.java:199) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

racknoris commented 5 years ago

@dmdnkv Did you get a response from google support?

dmdnkv commented 5 years ago

@racknoris yes, they answered recently. They didn't answer widely on my question but it has been said that the app, I am asking for to check after the last upload, has 64 bit support and I don't need to update anything regarding 64 bit case. So, I would say, that removing x86 platform from APK resolves the issue.

tscislo commented 5 years ago

Guys! I made the changes suggested by @dmdnkv and now I'm waiting for Google support to verify it. Is there and way to launch application with the following setup: abiFilters.addAll(['armeabi-v7a','arm64-v8a', 'x86', 'x86_64']) on Android emulator either 32 or 64 bit?

dmdnkv commented 5 years ago

@tscislo x86_64 fails on either real device or Android emulator, the reason is the lack of 'libNativeScript.so' in the output APK, but x86 (32bit) should work on Android emulator without any problems.

tscislo commented 5 years ago

@dmdnkv that is correct it works on emulator with x86, thanks!

racknoris commented 5 years ago

@tscislo did google respond?

tscislo commented 5 years ago

@racknoris yes, I did they simply said that if there is no more warning in Google Dev Console for this release it means that it is ok. Problem is that there has never been any warning, I just got an e-mail like all the others. So I assume it is done.

racknoris commented 5 years ago

I see, thank you

mobilekbs commented 5 years ago

The same problem. It was decided to skip x86 platform support for our app as a workaround since almost 99% of mobile devices use ARM. The following config could help:

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

Supported count of devices was decreased by 6 from 10557 to 10551 (that was displayed in Google Console App releases section after the roll out with that configuration)

Hello everyone,

I have the same problem. I am unable to get 64 bit libs to show up. I have followed these steps but still nothing.

I even got the error:

Cannot invoke method clear() on null object

Can anyone guide me in a correct direction?

Thank you in advance

My Gradle file:


      versionName "1.6.6"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true

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

any resolutions on this issue? i need to release a new version of my app and just encountered it. i tried all the solutions suggested here to no avail.

when i install the app on my device, like @ExaltedJim reports, it crashes upon launch. i get a blank white screen and it stops working. i can never see the initial screen

i tired adding following to the app.gradle:

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

and also:

ndk {
abiFilters.clear()
abiFilters.addAll(['armeabi-v7a','arm64-v8a', 'x86'])
}

and

ndk {
abiFilters.clear()
abiFilters.addAll(['armeabi-v7a','arm64-v8a'])
}

without 'x86' and/or 'x86_64'.

dmdnkv commented 5 years ago

@nudiref I would suggest you to check the logs and see what is the reason of the crash and if you see something like couldn't find "libNativeScript.so" it is related to this x86_64 issue, otherwise it is something else.

If you run debug build on the device it is also might be worthy to do a clean rebuild after those gradle manipulations: tns platform clean android tns build android --clean

Moreover, if you said that you see a blank screen it might be not x86_64 problem because when I had this problem it is even didn't launch anything and showed the app crash message on the OS home page. I think the reason of that is this missing libNativeScript.so that might be required to at least start to show something after it has been loaded.

nudiref commented 5 years ago

thanks for the feedback @dmdnkv

when i look at the logcat i see the following:

28772 F DEBUG : backtrace: 28772 F DEBUG : #00 pc 0000000000b03ecc /data/app/com.myApp-NUC4XcsB72yaChZyxNYiTg==/lib/arm64/libNativeScript.so 28772 F DEBUG : #01 pc 0000000000b04e74 /data/app/com.myApp-NUC4XcsB72yaChZyxNYiTg==/lib/arm64/libNativeScript.so 28772 F DEBUG : #02 pc 0000000000ad9870 /data/app/com.myApp-NUC4XcsB72yaChZyxNYiTg==/lib/arm64/libNativeScript.so (__cxa_throw+112) 28772 F DEBUG : #03 pc 00000000001c75d0 /data/app/com.myApp-NUC4XcsB72yaChZyxNYiTg==/lib/arm64/libNativeScript.so (SIGABRT_handler(int)+132)

does that mean that the problem is due to 'arm64-v8a'?

dmdnkv commented 5 years ago

@nudiref according to my understanding of the log you provided I could assume that libNativeScript.so is there in place, since the trace shows that some execution is going on inside it, so it seems to be the problem isn't related to its absence that is what we are discussing in this issue.

I would suggest trying to debug it might be by excluding some libraries/plugins one by one or whatever you use in your app until it works. Did you try to run a blank "Hello World" app on that device with the same build options?

n0mer commented 5 years ago

Today Google Play Store stopped accepting APKs without 64-bit support.

And, this page https://docs.nativescript.org/core-concepts/android-runtime/requirements does not have arm64-v8a in the list of supported ABIs

AppsByFen commented 5 years ago

So we cannot publish apps to the Google Play anymore? I just wanted publish it today and I get the same error message. I didn't get it yesterday

kzimny commented 5 years ago

change your app.gradle as follow:

android {
  defaultConfig {
    generatedDensities = []
      applicationId = 'org.test.myapp'
    ndk {
      abiFilters.clear()
      abiFilters.addAll(['armeabi-v7a','arm64-v8a'])
    }
  }
  aaptOptions {
    additionalParameters '--no-version-vectors'
  }
}

It works! Look at my previous post.

n0mer commented 5 years ago

@kzimny the point is that with such config it does not.

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

Can you please give any hint how to debug this, or make it work?

kzimny commented 5 years ago

Why do you need x86 and x86_64 devices? Please read my previous posts:

  1. https://github.com/NativeScript/nativescript-cli/issues/4330#issuecomment-510478500
  2. https://github.com/NativeScript/nativescript-cli/issues/4330#issuecomment-510534508 Believe, you don't need x86 and x86_64 devices except your app should run on watches (wearable devices).
NathanaelA commented 5 years ago

@kzimny - Actually their are some x86 devices, Asus made several of them (in fact I have access to one of them for testing. :grinning:) that are decent devices. So removing x86 will eliminate these devices from using the app.

kzimny commented 5 years ago

Check how many devices you will loose and decide yourself what is better. Wait for the next release 6.x.x or upgrade as described above.

NathanaelA commented 5 years ago

For those who care; I can confirm that because NS doesn't ship with the X86-64 bit runtime, you are now blocked on uploading UNLESS you strip out all x86 support (see Kzimny's post above https://github.com/NativeScript/nativescript-cli/issues/4330#issuecomment-522721510).

You will see this message: image

Which links you to this document: https://developer.android.com/distribute/best-practices/develop/64-bit

Which specifically does say that you need a 64bit runtime for x86 to deploy.