Android-runtime: There is no JNI on libs folder on NativeScript 2.1.1

Created on 7 Jul 2016  路  8Comments  路  Source: NativeScript/android-runtime

On NativeScript 2.0 and before it I was able to manually remove the unneeded ABI builds of the NativeScript Runtime from the /platforms/android/libs/jni/ folder.

Now, with NS 2.1 I cant. I consider this is very important for us. NativeScript blog already published a post (read "Multiple APKs in NativeScript" paragraph) about that with a tutorial on doing this trick. I have use that trick to make the android apk size smaller.

How to do multiple APKs on NS 2.1?

question

Most helpful comment

Hi @calebeaires,
A solution to your problem would be:

  • open <app_name>/app/App_Resources/Android/app.gradle
  • add:
android {
....
    splits {
        abi {
            enable true //enables the ABIs split mechanism
            reset() //reset the list of ABIs to be included to an empty string
            include 'platform_to_include'
        }
    }
...

_platform_to_include_ can currently be: arm64-v8a, armeabi-v7a or x86

  • run tns run android

Read more here
Please share if this solution works for you.

All 8 comments

Hi @calebeaires,
As a workaround i can suggest going into <app_name>/platforms/android/libs/runtime-libs/ opening nativescript.aar with some file archiver. Once opened, go to /jni/ folder and delete what you don't want as you did before. This will have the previous effect.

I have tried to do that, but it did not work.

  1. Unzip the file
  2. Go into the folder `nativescript/jni/``
  3. Remove the ABI
  4. Compact it again
  5. run tns build android

The file is there, but is was not recognized

A problem was found with the configuration of task ':prepareExampleRuntimeUnspecifiedLibrary'.
> File '/Users/macbook/Sites/Dev/example/platforms/android/libs/runtime-libs/nativescript.aar' specified for property 'bundle' does not exist.

Hi @calebeaires
There is no need to unzip and zip again, just open the nativescript.aar with winzip or 7zip, delete the files that you don't need and run the build..
I can't seem to reproduce your problem, but you can try cleaning the project, by deleting the <app_name>/platforms/android/build/ folder.
For future reference please use the template provided for creating new issues.

I did it. My error was that after all processes, the name of the file was nativescript.aar.zip. I didnt release that.

馃憤
I did it, apk size is smaller but when to publish the app, Google Play Store Developer Console dont recognize that is just one of then. I took a little screen of Play Store D. Console
captura de tela 2016-07-08 as 16 03 07

Hi @calebeaires,
A solution to your problem would be:

  • open <app_name>/app/App_Resources/Android/app.gradle
  • add:
android {
....
    splits {
        abi {
            enable true //enables the ABIs split mechanism
            reset() //reset the list of ABIs to be included to an empty string
            include 'platform_to_include'
        }
    }
...

_platform_to_include_ can currently be: arm64-v8a, armeabi-v7a or x86

  • run tns run android

Read more here
Please share if this solution works for you.

It works like a charm. I did it and manually change the versionCode on Android Manifest. I tested on real device to.

Thank you for the help @calebeaires. I'll update the "how to publish android" documentation with this information.

Was this page helpful?
0 / 5 - 0 ratings