7

将 Vim Syntastic 与 android 项目一起使用。(例如com.myproject.project)它不知道在我的项目中但在当前文件之外声明的类。例如以下标志错误:

import com.myproject.project.SomeClass;
...
SomeClass someclass = new SomeClass();
4

2 回答 2

10

看到这篇文章配置 syntastic 以与解决问题的 Android 项目一起正常工作:

方法一:
在vim编辑器里面

:SyntasticJavacEditClasspath

然后将以下内容添加到缓冲区窗口

/path-to-your-app/bin/classes  
/path-to-your-android-sdk/platforms/android-19/*.jar

方法二:
在.vimrc中加入以下内容:

let g:syntastic_java_javac_classpath = "/<path-to-your-app>/bin/classes:/<path-to-your-android-sdk>/platforms/android-19/*.jar"
于 2014-03-16T02:29:08.723 回答
1

这是对我在 linux vim7.4 和 Syntastic3.7.0-224 中对我有用的各种方法的摘要,每个方法都归功于它们。

方法 1 - 手动创建 .syntastic_javac_config

1. Edit .vimrc and use this syntax:
let g:syntastic_java_javac_config_file_enabled = 1

2. Where you edit your vim files, add this to a file named .syntastic_javac_config

let g:syntastic_java_javac_classpath = '/home/davis/progs/princeton-algos/week1/libs/algs4.jar'

方法 2 - 优势无论您在哪里编辑类路径都是已知的。

1. Edit .vimrc and use this syntax:
let g:syntastic_java_javac_classpath = "/home/davis/progs/princeton-algos/week1/libs/algs4.jar"

这增加了罐子和

方法 3 - 自动生成 .syntastic_javac_config 文件

1. Edit .vimrc and use this syntax:
let g:syntastic_java_javac_config_file_enabled = 1
2. Edit a java file with vim
3. :SyntasticJavacEditClasspath
When the edit window opens, add the class path without quotes and a newline after each entry the class path. In my case, this is the entry
for the setting includes the current folder as well:
/home/davis/progs/princeton-algos/week1/libs/algs4.jar
.
4 :wq the edit setting window
5. Now the class path is set for syntastic when editing files from that location. If you edit from a new directory, you will need to repeat the process.

除了上面的评论,这篇文章也有帮助。

于 2016-09-18T22:22:33.937 回答