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

When using kotlin sometimes the metadata is not existing in the result apk #1476

Closed
vtrifonov opened this issue Sep 11, 2019 · 0 comments
Closed
Milestone

Comments

@vtrifonov
Copy link
Contributor

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: 6.1.0
  • Cross-platform modules: 6.1.0
  • Android Runtime: 6.1.0

Describe the bug
When using Kotlin jar file included in the App_Resources/Android/libs folder and App_Resources/Android/gradle.properties is added with the following content:

useKotlin=true

It may cause the app to crash when you run tns run android with:

Gradle build...
         + setting applicationId
         + applying user-defined configuration from /Users/trifonov/Work/tmp/test/app/App_Resources/Android/app.gradle
         + using android X library androidx.legacy:legacy-support-v4:1.0.0
         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
         + adding aar plugin dependency: /Users/trifonov/Work/tmp/test/node_modules/tns-core-modules-widgets/platforms/android/widgets-release.aar
Exception in thread "main" java.lang.RuntimeException: Class not found OnNavigationItemReselectedListener
        at org.nativescript.staticbindinggenerator.Generator.getClass(Generator.java:549)
        at org.nativescript.staticbindinggenerator.Generator.getInterfacesFromCache(Generator.java:532)
        at org.nativescript.staticbindinggenerator.Generator.writeBinding(Generator.java:283)
        at org.nativescript.staticbindinggenerator.Generator.generateBinding(Generator.java:171)
        at org.nativescript.staticbindinggenerator.Generator.processRows(Generator.java:234)
        at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:121)
        at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:97)
        at org.nativescript.staticbindinggenerator.Main.main(Main.java:53)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:runSbg'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_141.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 17s
Command ./gradlew failed with exit code 1

This is happening not on every machine, seems that it more often happens on machines with more CPU cores.

The cause of the problem above is that for some reason the buildMetadata task is executed after the mergeDebugAssets task and thus the generated metadata files will be missing in the result apk file and this will cause the application to crash.

@vtrifonov vtrifonov added this to the 6.2.0 milestone Sep 11, 2019
@vtrifonov vtrifonov changed the title When using kotlin it may happen that the metadata is not existing in the result apk When using kotlin sometimes the metadata is not existing in the result apk Sep 11, 2019
@vhristov5555 vhristov5555 modified the milestones: 6.2.0, 6.1.1 Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants