繁体   English   中英

错误,当我将建立一个签名的apk

[英]error when i will build a signed apk

我将生成签名的APK时出现错误。 我做了很多事情,但无济于事...我会发布错误消息。 也许是我的错?

Information:Gradle tasks [:app:assembleRelease]
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2340Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIid902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet902Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuth902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthCommon902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthModule902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseConfig902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCrash902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabase902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseMessaging902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorage902Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorageCommon902Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl
:app:compileReleaseRenderscript
:app:generateReleaseBuildConfig
:app:mergeReleaseShaders
:app:compileReleaseShaders
:app:generateReleaseAssets
:app:mergeReleaseAssets
:app:generateReleaseResValues
:app:generateReleaseResources
:app:mergeReleaseResources
:app:processReleaseManifest
:app:processReleaseResources
:app:generateReleaseSources
:app:incrementalReleaseJavaCompilationSafeguard
:app:compileReleaseJavaWithJavac
:app:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:lintVitalRelease
:app:prePackageMarkerForRelease
:app:transformClassesWithDexForRelease
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
:app:transformClassesWithDexForRelease FAILED
Error:Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 2 mins 41.454 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console

这些是错误

错误1:

Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

错误2:

Error:Execution failed for task ':app:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

我希望任何人都可以帮助我解决这个严重的错误

错误1清楚地说明了原因。 这是解决方案

查看应用程序的直接和传递依赖关系-确保以任何方式使用您包含在应用程序中的任何大型库依赖关系,而这些依赖关系要超过添加到应用程序中的代码量。 常见的反模式是包括一个非常大的库,因为一些实用程序方法很有用。 减少应用程序代码依赖性通常可以帮助您避免dex参考限制。

使用ProGuard删除未使用的代码-为您的应用程序配置ProGuard设置以运行ProGuard,并确保为发布版本启用收缩功能。 启用缩小功能可确保您不会随APK一起发送未使用的代码。

同样在您的build.gradle中添加此

defaultConfig {
// Other settings here
multiDexEnabled true
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM