intellij 出现“Usage of API documented as @since 1.6+”的解决办法

2018-01-17 16:42:59

Usage of API documented as @since 1.6+ This inspection finds all usages of methods that have @since tag in their documentation. This may be useful when development is performed under newer SDK version as the target platform for production

 

File ->Project Structure->Project Settings -> Modules -> 你的Module名字 -> Sources -> Language Level->选个默认的就行。



1、error 1:Intellij Error:usage of api documented as @since 1.6+

错误场景:

开发工具:Intellij

在使用最新的Java8库的时候(我用的是Date.toInstant() ),在调用该方法的地方会有错误提示:

Usage of API documented as @since 1.6+ This inspection finds all usages of methods that have @since tag in their documentation. This may be useful when development is performed under newer SDK version as the target platform for production

问题解决:

    查阅资料发现这可能是其他项目的设置影响了编译器的等级。当编译器发现源代码和目标Java版本与设置的编译版本不同时,便会报这个错误。

    要解决该问题,需作如下配置:Flie -> Project Structure -> Project Settings -> Modules -> "Your Module Name" -> Sources ->Language Level ,然后将其更改为所需级别,即8或"项目默认语言级别"。


2、error 2: Error:java: Compilation failed: internal java compiler error


问题解决:按照方法1修改语言级别后,Maven-->Reimport, 再次编译,问题会还原,所以这样不能根本解决问题。

需要做的是在Maven依赖配置文件pom.xml中添加complier插件,并且指定版本,就不会再报错了:

[java] view plain copy

  1. <build>  

  2.     <plugins>  

  3.         <plugin>  

  4.             <groupId>org.apache.maven.plugins</groupId>  

  5.             <artifactId>maven-compiler-plugin</artifactId>  

  6.             <version>3.6.0</version>  

  7.             <configuration>  

  8.                 <source>1.8</source>  

  9.                 <target>1.8</target>  

  10.             </configuration>  

  11.         </plugin>  

  12.     </plugins>  

  13. </build>  


  • 2020-02-02 19:24:38

    百度视频SDK,突然不能播放

    开发过程中,不知道什么时候开始视频不能播发了,怎么办都不行,其他项目没问题,线上都也没有问题,这可急躁完蛋我了,整了仨小时,还是那熊样。 哎。

  • 2020-02-04 18:43:10

    AssetManager.finalize() Timed Out 解决办法以及分析

    在我们的项目崩溃中,有一个比较常见的bug,就是 java.util.concurrent.TimeoutException android.content.res.AssetManager.finalize() timed out after 10 seconds 意思简单明了,就是说在AssetManager析构的时候发生了超时异常。

  • 2020-02-06 13:32:10

    android.os.NetworkOnMainThreadException

    在Android 4.0以上,网络连接不能放在主线程上,不然就会报错android.os.NetworkOnMainThreadException。但是4.0下版本可以不会报错。

  • 2020-02-07 23:46:44

    You must call removeView() on the child's parent first解决办法

    出现这样的情况最多是发生在recyclerView中,holder复用的过程中,多次添加view,第一次添加的时候view有了父类了,可能就是复用引起的。 我是发生在给recyclerView添加广告view的时候发生的。

  • 2020-02-11 17:43:35

    基于VCamera,仿微信录制短视频

    vcamera.so这个确实挺好用,可定制性也挺高,但是确定也不小,需要引入的这个so包,10M啊。对于安装包苛刻的用户,这是致命啊。 我现在是抛弃他了。但是在这里还是记录一下用法吧。防止以后再用他。