Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 错误:(116)错误:类型id为[ResourceType]的预期资源_Java_Android - Fatal编程技术网

Java 错误:(116)错误:类型id为[ResourceType]的预期资源

Java 错误:(116)错误:类型id为[ResourceType]的预期资源,java,android,Java,Android,当我调试我的应用程序时,没有错误,但当我生成已签名的应用程序时,有以下错误: /Users/dariobrun/Documents/AndroidStudioProjects/PGNChessEditor/app/src/main/java/it/dario/brun/pgnchesseditor/app/PannelloScacchiera.java:116: Error: Expected resource of type id [ResourceType] b

当我调试我的应用程序时,没有错误,但当我生成已签名的应用程序时,有以下错误:

   /Users/dariobrun/Documents/AndroidStudioProjects/PGNChessEditor/app/src/main/java/it/dario/brun/pgnchesseditor/app/PannelloScacchiera.java:116: Error: Expected resource of type id [ResourceType]
            black.setId(1);
                        ~

       Explanation for issues of type "ResourceType":
       Ensures that resource id's passed to APIs are of the right type; for
       example, calling Resources.getColor(R.string.name) is wrong.

    1 errors, 0 warnings

     FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:lintVitalRelease'.
    > Lint found fatal errors while assembling a release target.

      To proceed, either fix the issues identified by lint, or modify your build script as follows:
      ...
      android {
          lintOptions {
              checkReleaseBuilds false
              // Or, if you prefer, you can continue to check for errors in release builds,
              // but continue the build even when errors are found:
              abortOnError false
          }
      }
      ...

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 3s

    25 actionable tasks: 3 executed, 22 up-to-date
这是生成错误的java代码:

  black=new RadioButton(context);
    black.setTextSize(TypedValue.COMPLEX_UNIT_PX,context.getResources().getDimension(R.dimen.pannello_size));
    black.setText(getResources().getString(R.string.moveblack));
    black.setId(1);
但即使它说“构建失败”,签名的apk也生成了,并且工作正常。 那么,发生了什么事?我应该担心吗

Lint在组装发布目标时发现了致命错误

了解

Android Gradle插件允许您使用模块级
build.Gradle
文件中的
lintOptions{}
块配置某些lint选项,例如运行或忽略哪些检查

 lintOptions 
   {
       abortOnError false
       checkReleaseBuilds false
   }
之后,
清理重建运行