相关疑难解决方法(0)

Android Studio中"无法解析符号R"

在我引用的所有类中的每个实例中R.id.something,它R都是红色的,并且表示"无法解析符号R".此外,每次有R.layout.something红色下划线并说"无法解析方法setContentView(?)".该项目总是很好.一直看到这一点很烦人.我在这里已经阅读了许多关于类似的东西的其他问题,但大部分涉及从Eclipse导入项目.我正在使用我认为最新版本的Android Studio,该项目是使用Android Studio创建的,并且没有任何"无法解决R"问题.如果有人知道,我想知道是什么原因造成的.

android r.java-file android-studio

703
推荐指数
30
解决办法
108万
查看次数

如何在Mac上的IntelliJ IDEA中增加IDE内存限制?

我在Mountain Lion上使用IDEA 12 Leda.我想增加IDE可以使用的最大内存.我将Info.plist文件中的VMOptions设置为 -Xmx2048m -ea -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:../lib/boot.jar

当我打开IDEA时,我仍然看到最大内存为711m.

jps -v 显示我的VMOptions已加载,但它已被以下选项取代.

29388  **-Xmx2048m** -ea -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Xbootclasspath/a:../lib/boot.jar -Xms128m **-Xmx800m** -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=64m -XX:+UseCodeCacheFlushing -XX:+UseCompressedOops -Didea.paths.selector=IdeaIC12 -Dsun.java2d.noddraw=true -Didea.max.intellisense.filesize=2500 -Didea.dynamic.classpath=false -Didea.jars.nocopy=false -Dsun.java2d.d3d=false -Dapple.awt.fullscreencapturealldisplays=false -Dapple.laf.useScreenMenuBar=true -Djava.endorsed.dirs= -Dswing.bufferPerWindow=false -Didea.fatal.error.notification=enabled -Didea.cycle.buffer.size=1024 -Didea.popup.weight=heavy -Didea.xdebug.key=-Xdebug -Dapple.awt.graphics.UseQuartz=true -Dsun.java2d.pmoffscreen=false -Didea.no.launcher=false -DCVS_PASSFILE=~/.cvspass -Didea.use.default.antialiasing.in.editor=false -Dcom.apple.mrj.application.live-resize=false -Didea.smooth.progress=false
29392 Jps -Dapplication.home=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home -Xms8m
Run Code Online (Sandbox Code Playgroud)

哪里-Xmx800来的?我需要删除它.

java macos intellij-idea jvm-arguments

310
推荐指数
7
解决办法
22万
查看次数

为什么这么红?IntelliJ似乎认为无法找到/解决每个声明/方法

我刚刚安装并重新安装了IntelliJ.每个Java文件都会出现RED.我检查了JDK; 它是1.6.##.在maven clean install构建工作就好了.

我得到了通常突出显示的错误.在每个声明:

无法解析符号SomeEntityBean/Bean

并在每个方法:

无法解析方法SomeFunction()

如何修复这些错误错误?

java intellij-idea

113
推荐指数
9
解决办法
11万
查看次数

无法将Intellij与生成的源文件夹一起使用

相关问题 如何配置IntelliJ IDEA和/或Maven自动添加使用jaxb2-maven-plugin生成的Java源代码的目录?

我有一个自定义插件,可以生成源代码target/generated-sources(注意这里没有工具名).所以我得到像target/generated-sources/com/mycompany......等来源.

这种格式根本无法更改,因此我可以将Intellij配置为将其添加为源文件夹.截至目前,我可以看到Intellij已添加target/generated-sources/com为源文件夹.

请注意,我没有配置插件的选项!

更新1:我不同意我必须将生成的源放在工具名称文件夹下的事实.这可能是一个很好的约定,但如果我只有一台发电机,我就没有必要把它放在那里?同样,在我的pom.xml中,我有一个resources部分清楚地表明target/generated-sources应该将其视为源文件夹.这在Eclipse中运行得非常好,所以我不知道为什么Intellij不尊重我的设置.

TL; DR - >当我放入target/generated-sources资源部分时pom.xml为什么Intellij过分热衷于添加target/generated-sources/com到类路径?

java maven-2 intellij-idea

71
推荐指数
8
解决办法
9万
查看次数

IntelliJ 无法识别生成的源

已经有很多类似的问题,但没有提出的解决方案(主要是“清除缓存并重新启动 IntelliJ)”解决我的问题。

我有一个导入到 IntelliJ Community Edition 2017.1 的 Maven 项目。我的 Maven 构建会自动从 Google protobuf 规范创建一些 Java 源代码。

摘自pom.xml

         <plugin>
            <groupId>com.github.os72</groupId>
            <artifactId>protoc-jar-maven-plugin</artifactId>
            <version>3.2.0</version>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <protocVersion>3.1.0</protocVersion> <!-- 2.4.1, 2.5.0, 2.6.1, 3.1.0 -->
                        <inputDirectories>
                            <include>src/main/protobuf</include>
                        </inputDirectories>
                        <outputDirectory>${project.build.directory}/generated-sources/protobuf</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

文件夹/generated-sources/protobuf被正确识别为“generated-sources”,带有蓝色图标和 IntelliJ -> File -> Project Structure -> Modules -> Sources 下生成源的轮子

Maven 目标“编译”也可以正常工作。

但是 IntelliJ“内部”java 编译器为我生成的类抱怨“无法解析符号”。

到目前为止我累了的解决方案

  1. 添加一个中间文件夹 /target/generated-sources/ protobuf / => 没有帮助
  2. 使缓存无效,删除项目文件,重新导入,重新启动 IDE => 没有帮助
  3. Maven -> 重新导入所有项目 => 没有帮助 …

intellij-idea maven

6
推荐指数
2
解决办法
4731
查看次数