当我使用 google 地图时生成签名的 apk 时出错?
Error while generating signed apk when i use google map?
您好,我在生成签名的 apk 时遇到此错误:
Error: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
}
}
这是我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.OMMSoftware.Navsahydri">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:protectionLevel="signature" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:protectionLevel="signature" />
<uses-library
android:name="com.google.android.maps"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/logo_circular"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/MyMaterialTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDjqmmXd1d1yk7BtncDQgXSmya-NdBkc2w" />
<activity android:name=".Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Home" />
<activity android:name=".Gallery" />
<activity android:name=".Contactus" />
<activity android:name=".Placements"></activity>
</application>
</manifest>
代码没有错误,即使 apk 正在构建,但是当我尝试生成签名的 apk 时它显示上述错误,我在我的 project.Please 帮助中使用 google 地图。
Gradle 的 Android 插件允许您配置某些 lint 选项,例如检查 运行 或忽略,使用 lintOptions {} 模块级 build.gradle 文件中的块。
android {
...
lintOptions {
checkReleaseBuilds false
abortOnError false
ignoreWarnings true //false
}
}
然后 清理重建 和 运行 .
将 lintOptions 设置为忽略错误或警告并不是解决此问题并等待应用程序在发布版本中崩溃的方法。
解决此问题的理想方法是确保我们在构建 APK 之前修复错误。您可以从 Android Studio (Android Studio Main Menu > Analyze > Inspect Code
) 中 运行 "Inspect Code" 实用程序。选择 Inspection Scope 作为 Whole Project
和 运行 utility。修复所有报告的错误,您应该能够构建 APK。
请注意,如果您想摆脱这个问题,就必须修复每一个错误。还有一点需要注意:Lint 实用程序会自动为您提供选项(在大多数情况下)来修复错误。根据您的判断 use/not 使用它们。
旁注:如果您正在使用任何自定义模块并且您有权访问源代码,请确保未使用已弃用的 API in-contra 您正在编译和定位的 SDK 版本。
在所有潜在的 crash-causing-errors 都已解决后,您仍然遇到问题,然后将 lintOption abortOnError
设置为 false
,但将选项 checkReleaseBuilds
保留为 true
,因此您可以继续构建 APK,并且在构建时仍然会看到错误并根据需要修复它们。
您好,我在生成签名的 apk 时遇到此错误:
Error: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
}
}
这是我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.OMMSoftware.Navsahydri">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:protectionLevel="signature" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:protectionLevel="signature" />
<uses-library
android:name="com.google.android.maps"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@drawable/logo_circular"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/MyMaterialTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDjqmmXd1d1yk7BtncDQgXSmya-NdBkc2w" />
<activity android:name=".Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Home" />
<activity android:name=".Gallery" />
<activity android:name=".Contactus" />
<activity android:name=".Placements"></activity>
</application>
</manifest>
代码没有错误,即使 apk 正在构建,但是当我尝试生成签名的 apk 时它显示上述错误,我在我的 project.Please 帮助中使用 google 地图。
Gradle 的 Android 插件允许您配置某些 lint 选项,例如检查 运行 或忽略,使用 lintOptions {} 模块级 build.gradle 文件中的块。
android {
...
lintOptions {
checkReleaseBuilds false
abortOnError false
ignoreWarnings true //false
}
}
然后 清理重建 和 运行 .
将 lintOptions 设置为忽略错误或警告并不是解决此问题并等待应用程序在发布版本中崩溃的方法。
解决此问题的理想方法是确保我们在构建 APK 之前修复错误。您可以从 Android Studio (Android Studio Main Menu > Analyze > Inspect Code
) 中 运行 "Inspect Code" 实用程序。选择 Inspection Scope 作为 Whole Project
和 运行 utility。修复所有报告的错误,您应该能够构建 APK。
请注意,如果您想摆脱这个问题,就必须修复每一个错误。还有一点需要注意:Lint 实用程序会自动为您提供选项(在大多数情况下)来修复错误。根据您的判断 use/not 使用它们。
旁注:如果您正在使用任何自定义模块并且您有权访问源代码,请确保未使用已弃用的 API in-contra 您正在编译和定位的 SDK 版本。
在所有潜在的 crash-causing-errors 都已解决后,您仍然遇到问题,然后将 lintOption abortOnError
设置为 false
,但将选项 checkReleaseBuilds
保留为 true
,因此您可以继续构建 APK,并且在构建时仍然会看到错误并根据需要修复它们。