我已经在cordova项目中成功配置了launch.json
文件,以便调试/逐步执行JAVA程序(虽然它并不完美)。
我做的第一件事就是为java扩展安装语言工具。
然后我更新了.vscode/launch.json
{ “版本”:“0.2.0”, “配置”:[ { “type”:“android”, “name”:“Android Debug”, “请求”:“发布”, “appSrcRoot”:“$ {workspaceRoot} / platforms / android”, “apkFile”:“$ {workspaceRoot} /platforms/android/build/outputs/apk/android-debug.apk”, “adbPort”:5037 } ] }
然后我修改了AndroidManifest.xml
以更改android:name="MainActivity"
以阅读以下标记中的android:name=".MainActivity"
:
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name=".MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
从那里我可以在VSCODE
调试器中逐步执行我自己的代码。
我仍然遇到的问题是在OUTPUT窗口中。我遇到了一再错误:
首次加载项目时,我会得到3到4次:
[Error - 9:39:52 AM] Jun 9, 2017 9:39:13 AM Synchronize Gradle projects with workspace failed due to an error configuring Eclipse.
Can't read root project location for project located at C:\www\pdf-generator-example\platforms\android
org.eclipse.buildship.core.GradlePluginsRuntimeException: Can't read root project location for project located at C:\www\pdf-generator-example\platforms\android
at org.eclipse.buildship.core.configuration.internal.BuildConfigurationPersistence.readPathToRoot(BuildConfigurationPersistence.java:79)
at org.eclipse.buildship.core.configuration.internal.DefaultConfigurationManager.loadProjectConfiguration(DefaultConfigurationManager.java:107)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation$3.apply(SynchronizeGradleBuildOperation.java:157)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation$3.apply(SynchronizeGradleBuildOperation.java:153)
at com.google.common.collect.Iterators$6.computeNext(Iterators.java:617)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:145)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:140)
at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:267)
at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:229)
at com.google.common.collect.FluentIterable.toList(FluentIterable.java:609)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.getOpenWorkspaceProjectsRemovedFromGradleBuild(SynchronizeGradleBuildOperation.java:161)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.synchronizeProjectsWithWorkspace(SynchronizeGradleBuildOperation.java:120)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildOperation.run(SynchronizeGradleBuildOperation.java:115)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.synchronizeBuild(SynchronizeGradleBuildsJob.java:85)
at org.eclipse.buildship.core.workspace.internal.SynchronizeGradleBuildsJob.runToolingApiJob(SynchronizeGradleBuildsJob.java:73)
at org.eclipse.buildship.core.util.progress.ToolingApiJob$1.run(ToolingApiJob.java:73)
at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(ToolingApiInvoker.java:62)
at org.eclipse.buildship.core.util.progress.ToolingApiJob.run(ToolingApiJob.java:70)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
然后这个“频繁”可能每分钟一次或两次:
[Error - 9:40:28 AM] Jun 9, 2017 9:39:13 AM An internal error occurred during: "Update project android".
Can't read root project location for project located at C:\www\pdf-generator-example\platforms\android
org.eclipse.buildship.core.GradlePluginsRuntimeException: Can't read root project location for project located at C:\www\pdf-generator-example\platforms\android
at org.eclipse.buildship.core.configuration.internal.BuildConfigurationPersistence.readPathToRoot(BuildConfigurationPersistence.java:79)
at org.eclipse.buildship.core.configuration.internal.DefaultConfigurationManager.loadProjectConfiguration(DefaultConfigurationManager.java:107)
at org.eclipse.buildship.core.workspace.internal.DefaultGradleWorkspaceManager.getGradleBuild(DefaultGradleWorkspaceManager.java:64)
at org.eclipse.jdt.ls.core.internal.managers.GradleBuildSupport.update(GradleBuildSupport.java:42)
at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager$1.runInWorkspace(ProjectsManager.java:214)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
我在stackoverflow上看到的其他解决方案提供了如何使用eclipse IDE中的命令解决此问题的说明(选择此菜单,重新添加项目,单击此按钮并修复我的'魔术' IDE)
我想知道是否有人知道这里发生了什么“在帽子下面”足以让我可以解决这个问题而不使用eclipse中的IDE技巧(因为我没有安装它)
如果您正在寻找可以使用的项目,请随时查看:https://github.com/AlexChesser/pdf-generator-example我目前正在为插件功能做出贡献,并希望简化我的VSCODE配置。