升级NativeScript 5.1后Android端启动出现日志信息求助
Hey there, let's walk through actionable steps to diagnose those repeating ART runtime logs you're seeing after upgrading to NativeScript 5.1 and tns-core-modules 5.1.2. First, note that these logs track JS-to-native method calls in the ART VM—while they aren't errors on their own, their repetition points to a loop or unintended repeated invocation somewhere in your setup.
Here's how to dig into it:
Verify debug/logging settings aren't amplifying output
Double-check if you're running the app in debug mode (viatns run android --debug) or if any debug flags are enabled in your code/configuration. Also, check yourAndroidManifest.xmlto ensureandroid:debuggableisn't set totrueunnecessarily (it should default to false for release builds, but debug builds might trigger more verbose ART logging).Rule out incompatible third-party plugins
NativeScript 5.1 introduced runtime changes that might break older plugins. Try this:- Temporarily remove all non-essential plugins from your
package.json. - Run
npm install, thentns cleanand rebuild the app. - If the logs disappear, re-add plugins one by one and rebuild each time to find the incompatible one. Check the plugin's repo for updates or issues related to NativeScript 5.1 compatibility.
- Temporarily remove all non-essential plugins from your
Perform a full cache purge (beyond what you've already done)
You've deleted core modules, hooks, and the Android platform folder—but there are more caches to clear:- Delete your project's
node_modulesfolder and runnpm installfresh. - Clear Android Gradle caches: Delete the
.gradlefolder in your project root, plus the global Gradle cache (usually at~/.gradle/cacheson macOS/Linux orC:\Users\<YourUser>\.gradle\cacheson Windows). - Run
tns cleanto clear NativeScript's internal cache.
- Delete your project's
Check custom native code/JNI integrations
If your project uses custom Android Java code or JNI bindings, these might be triggering repeated JS method calls after the runtime upgrade. Look for:- Loops in native code that repeatedly call
com.tns.Runtime.callJSMethodvariants. - Mismatches in method signatures between your native code and the updated NativeScript runtime (5.1 might have changed how method arguments are handled).
- Loops in native code that repeatedly call
Trace the root JS trigger with verbose logging
Use NativeScript's trace-level logging to pinpoint which JS method is causing the repeated native calls:
Runtns run android --log trace—this will output detailed logs that link the ART calls back to specific JS functions. Look for patterns in the trace logs right before the repeating ART entries to identify the problematic code.Check NativeScript 5.1 release notes for known issues
Review the official NativeScript 5.1 release documentation to see if other users reported similar runtime logging loops, or if there are documented breaking changes related to JS-native method invocation that might apply to your project.
内容的提问来源于stack exchange,提问作者relez

