Java 生成签名的apk时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24098494/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 10:09:26  来源:igfitidea点击:

Error when generate signed apk

javaandroidgradle

提问by user3716366

I've tried to upload my apk on google play and encountered an error message: "You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs."

我尝试在 google play 上上传我的 apk,但遇到错误消息:“您上传了一个可调试的 APK。出于安全原因,您需要先禁用调试,然后才能在 Google Play 中发布。了解有关可调试 APK 的更多信息。”

Then I wrote android:debuggable="false"in my manifest and tried again. I've encountered the same error, so I"ve seted the build variant from my module to release and generate an apk again, but this, generated this error:

然后我写android:debuggable="false"在我的清单中并再次尝试。我遇到了同样的错误,所以我已经从我的模块中设置了构建变体来发布并再次生成一个 apk,但这产生了这个错误:

Error:Gradle: 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
      }
  }
  ...

采纳答案by Graydyn Young

I wouldn't recommend turning off the lint checks, they're there for a reason. Instead, check what the error is and fix it.

我不建议关闭 lint 检查,它们存在是有原因的。相反,检查错误是什么并修复它。

The error report is saved to [app module]/build/reports/lint-results-yourBuildName-fatal.html. You can open this file in a browser to read about the errors.

错误报告保存到[app module]/build/reports/lint-results-yourBuildName-fatal.html. 您可以在浏览器中打开此文件以了解错误信息。

It would be nice if Gradle could make it a little more clear where the error report is generated.

如果 Gradle 能够更清楚地说明错误报告的生成位置,那就太好了。

回答by Eran Goldin

Remove that statement from your manifest altogether, Eclipse will handle that for you on the fly.

从您的清单中完全删除该语句,Eclipse 将即时为您处理。

回答by naile

I had this problem and worked around it by adding

我遇到了这个问题并通过添加来解决它

lintOptions { 

    checkReleaseBuilds false

}

to my build.gradefile within the android{ }section.

到我build.grade在该android{ }部分中的文件。

回答by someone

Windows -> references ->Android->lint error checking.

Windows -> 参考 -> Android-> lint 错误检查。

un tick Run full error.......

取消勾选运行完整错误......

enter image description here

在此处输入图片说明

回答by Dhruv Raval

I have faced same issue when creating signed apk from android studio. I just change little bit change on build.gradlefile inside android {}

我在从 android studio 创建签名的 apk 时遇到了同样的问题。我只是对android {} 中的build.gradle文件进行了一些更改

lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

回答by Kamal

You should add the code in project level gradle file for generating apk overwriting over errors

您应该在项目级 gradle 文件中添加代码以生成覆盖错误的 apk

回答by Amit raj

***Try this***

 buildTypes {
        release {
            lintOptions {
                disable 'MissingTranslation'
                checkReleaseBuilds false
                abortOnError false
            }
            minifyEnabled false
            signingConfig signingConfigs.release
        }
    }

回答by Rehan Sarwar

Try These 3 lines in your app.gradle file.

在 app.gradle 文件中尝试这 3 行。

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
}

回答by Roberto

Make sure you defined all the translations in all the string.xmlfiles

确保您定义了所有string.xml文件中的所有翻译

回答by Pecolyte Wang

In case that you may trying to locate where the problem is, I found mine in the following path of my project: /app/build/reports/lint-results-release-fatal.html(or .xml).

如果您可能试图找到问题所在,我在我的项目的以下路径中找到了我的:/app/build/reports/lint-results-release-fatal.html(或 .xml)。

Hope this helps!

希望这可以帮助!