Skip to content
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

Snapshots with ABI splits do not work since Android Runtime 4.1.0 #1234

Closed
darind opened this issue Dec 17, 2018 · 0 comments
Closed

Snapshots with ABI splits do not work since Android Runtime 4.1.0 #1234

darind opened this issue Dec 17, 2018 · 0 comments
Assignees
Milestone

Comments

@darind
Copy link
Collaborator

darind commented Dec 17, 2018

Environment

Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.1.0
  • Cross-platform modules: 5.1.0
  • Android Runtime: 5.1.0

Describe the bug

ABI splits with snapshot do not work since android runtime 4.1.0.

To Reproduce

Enable ABI splits with snapshot as described in the documentation:

  1. Create an angular app: tns create test --ng
  2. Set useLibs and androidNdkPath in webpack.config.js:
if (snapshot) {
    config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({
        .............
        targetArchs: [ "arm", "arm64", "ia32" ],
        useLibs: true,
        androidNdkPath: "/home/ubuntu/ndkr18b/android-ndk-r18b"
    }));
}
  1. Enable ABI splits in App_Resources/Android/app.gradle:
android {
  defaultConfig {
    generatedDensities = []
    ndk {
      abiFilters.clear()
    }
  }
  aaptOptions {
    additionalParameters "--no-version-vectors"
  }
  splits {
    abi {
        enable true
        reset()
        include 'arm64-v8a', 'armeabi-v7a', 'x86'
        universalApk true
    }
  }
  sourceSets {
    main {
        jniLibs.srcDirs = ["$projectDir/libs/jni", "$projectDir/snapshot-build/build/ndk-build/libs"]
    }
  }
}
  1. Run the application in release mode with snapshot enabled:
tns run android --env.snapshot --bundle --release --key-store-path ~/some_key.jks --key-store-password some_secret --key-store-alias some_alias --key-store-alias-password some_secret

Expected behavior

The application starts correctly

Actual Behavior

The application crashes with the following exception:

12-17 17:43:14.340  5764  5764 W System.err: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{org.nativescript.snap2/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Failed to create JavaScript extend wrapper for class 'com/tns/NativeScriptActivity'
12-17 17:43:14.340  5764  5764 W System.err:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2391)
12-17 17:43:14.340  5764  5764 W System.err:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2540)
12-17 17:43:14.340  5764  5764 W System.err:    at android.app.ActivityThread.access$900(ActivityThread.java:150)
12-17 17:43:14.340  5764  5764 W System.err:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)
12-17 17:43:14.340  5764  5764 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:102)
12-17 17:43:14.340  5764  5764 W System.err:    at android.os.Looper.loop(Looper.java:168)
12-17 17:43:14.340  5764  5764 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:5781)
12-17 17:43:14.340  5764  5764 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
12-17 17:43:14.340  5764  5764 W System.err:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
12-17 17:43:14.340  5764  5764 W System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
12-17 17:43:14.340  5764  5764 W System.err: Caused by: com.tns.NativeScriptException: Failed to create JavaScript extend wrapper for class 'com/tns/NativeScriptActivity'
12-17 17:43:14.340  5764  5764 W System.err:    at com.tns.Runtime.createJSInstanceNative(Native Method)
12-17 17:43:14.340  5764  5764 W System.err:    at com.tns.Runtime.createJSInstance(Runtime.java:656)
12-17 17:43:14.340  5764  5764 W System.err:    at com.tns.Runtime.initInstance(Runtime.java:629)
12-17 17:43:14.340  5764  5764 W System.err:    at com.tns.NativeScriptActivity.<init>(NativeScriptActivity.java:12)
12-17 17:43:14.340  5764  5764 W System.err:    at java.lang.Class.newInstance(Native Method)
12-17 17:43:14.340  5764  5764 W System.err:    at android.app.Instrumentation.newActivity(Instrumentation.java:1085)
12-17 17:43:14.340  5764  5764 W System.err:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2381)
12-17 17:43:14.340  5764  5764 W System.err:    ... 9 more
@darind darind self-assigned this Dec 17, 2018
@darind darind changed the title Snapshots with ABI splits do not work Snapshots with ABI splits do not work since tns-android@4.1.0 Dec 17, 2018
@darind darind added this to the 5.2.0 milestone Dec 17, 2018
@Natalia-Hristova Natalia-Hristova self-assigned this Dec 18, 2018
@darind darind changed the title Snapshots with ABI splits do not work since tns-android@4.1.0 Snapshots with ABI splits do not work since Android Runtime 4.1.0 Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants