Skip to content

There is no JNI on libs folder on NativeScript 2.1.1 #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
calebeaires opened this issue Jul 7, 2016 · 8 comments
Closed

There is no JNI on libs folder on NativeScript 2.1.1 #518

calebeaires opened this issue Jul 7, 2016 · 8 comments
Labels

Comments

@calebeaires
Copy link

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?

@Plamen5kov
Copy link
Contributor

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.

@calebeaires
Copy link
Author

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.

@Plamen5kov
Copy link
Contributor

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.

@calebeaires
Copy link
Author

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

@calebeaires
Copy link
Author

calebeaires commented Jul 8, 2016

👍
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

@Plamen5kov
Copy link
Contributor

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.

@calebeaires
Copy link
Author

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

@Plamen5kov
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants