我有一个电子商务应用程序的android项目。它也发布在应用程序商店。我已在我的应用中更新了一些内容,例如com.google.android.gms:play-services:8.3.0
到com.google.android.gms:play-services:9.0.0
。之后,当我在本地设备上运行app时,运行perfact但是当我生成Signed Apk
时,这会产生如下错误
Information:Gradle tasks [:app:assembleRelease]
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:niceSpinner:preBuild UP-TO-DATE
:niceSpinner:preReleaseBuild UP-TO-DATE
:niceSpinner:compileReleaseNdk UP-TO-DATE
:niceSpinner:compileLint
:niceSpinner:copyReleaseLint UP-TO-DATE
:niceSpinner:checkReleaseManifest
:niceSpinner:preDebugAndroidTestBuild UP-TO-DATE
:niceSpinner:preDebugBuild UP-TO-DATE
:niceSpinner:preDebugUnitTestBuild UP-TO-DATE
:niceSpinner:preReleaseUnitTestBuild UP-TO-DATE
:niceSpinner:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:niceSpinner:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:niceSpinner:prepareReleaseDependencies
:niceSpinner:compileReleaseAidl UP-TO-DATE
:niceSpinner:compileReleaseRenderscript UP-TO-DATE
:niceSpinner:generateReleaseBuildConfig UP-TO-DATE
:niceSpinner:mergeReleaseShaders UP-TO-DATE
:niceSpinner:compileReleaseShaders UP-TO-DATE
:niceSpinner:generateReleaseAssets UP-TO-DATE
:niceSpinner:mergeReleaseAssets UP-TO-DATE
:niceSpinner:generateReleaseResValues UP-TO-DATE
:niceSpinner:generateReleaseResources UP-TO-DATE
:niceSpinner:mergeReleaseResources UP-TO-DATE
:niceSpinner:processReleaseManifest UP-TO-DATE
:niceSpinner:processReleaseResources UP-TO-DATE
:niceSpinner:generateReleaseSources UP-TO-DATE
:niceSpinner:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:niceSpinner:compileReleaseJavaWithJavac UP-TO-DATE
:niceSpinner:extractReleaseAnnotations UP-TO-DATE
:niceSpinner:mergeReleaseProguardFiles UP-TO-DATE
:niceSpinner:packageReleaseRenderscript UP-TO-DATE
:niceSpinner:packageReleaseResources UP-TO-DATE
:niceSpinner:processReleaseJavaRes UP-TO-DATE
:niceSpinner:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:niceSpinner:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:niceSpinner:mergeReleaseJniLibFolders UP-TO-DATE
:niceSpinner:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:niceSpinner:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:niceSpinner:bundleRelease UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72321Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2340Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:app:prepareComBignerdranchAndroidExpandablerecyclerview203Library UP-TO-DATE
:app:prepareComDaimajiaSliderLibrary115Library UP-TO-DATE
:app:prepareComDaimajiaSwipelayoutLibrary120Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk450Library UP-TO-DATE
:app:prepareComGithubShellSoftwareFab112Library UP-TO-DATE
:app:prepareComGithubShellSoftwareUitools110Library UP-TO-DATE
:app:prepareComGithubShellSoftwareViewmover110Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAdsLite900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalyticsImpl900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIid900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanager900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTagmanagerApi900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet900Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuth900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthCommon900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthModule900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseConfig900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCore900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCrash900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabase900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseDatabaseConnection900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseMessaging900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorage900Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseStorageCommon900Library UP-TO-DATE
:app:prepareComIntuitSdpSdpAndroid102Library UP-TO-DATE
:app:prepareComMakeramenRoundedimageview221Library UP-TO-DATE
:app:prepareComMarshalchenUltimaterecyclerviewLibrary0318Library UP-TO-DATE
:app:prepareComMiguelcatalanMaterialsearchview130Library UP-TO-DATE
:app:prepareComMikepenzActionitembadge318Library UP-TO-DATE
:app:prepareComMikepenzIconicsCore220Library UP-TO-DATE
:app:prepareComRengwuxianMaterialedittextLibrary203Library UP-TO-DATE
:app:prepareComWdullaerMaterialdatetimepicker202Library UP-TO-DATE
:app:prepareComWeiwangcnBetterspinnerLibraryMaterial110Library UP-TO-DATE
:app:prepareInSrainCubeUltraPtr1010Library UP-TO-DATE
:app:prepareNeedDepartmentalStoreNiceSpinnerUnspecifiedLibrary UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl
:app:compileReleaseRenderscript
:app:generateReleaseBuildConfig
:app:mergeReleaseShaders
:app:compileReleaseShaders
:app:generateReleaseAssets
:app:mergeReleaseAssets
:app:processReleaseManifest
:app:fabricGenerateResourcesRelease
:app:generateReleaseResValues UP-TO-DATE
:app:processReleaseGoogleServices
Parsing json file: /Users/dp/Desktop/current Project/NeedDepartmentalStore/app/google-services.json
:app:generateReleaseResources
:app:mergeReleaseResources
:app:processReleaseResources
:app:generateReleaseSources
:app:incrementalReleaseJavaCompilationSafeguard
:app:compileReleaseJavaWithJavac
:app:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:lintVitalRelease
:app:prePackageMarkerForRelease
:app:transformClassesWithJarMergingForRelease
:app:collectReleaseMultiDexComponents
:app:transformClassesWithMultidexlistForRelease
ProGuard, version 5.2.1
Reading program jar [/Users/dp/Desktop/current Project/NeedDepartmentalStore/app/build/intermediates/transforms/jarMerging/release/jars/1/1f/combined.jar]
Reading library jar [/Users/dp/Library/Android/sdk/build-tools/23.0.3/lib/shrinkedAndroid.jar]
Preparing output jar [/Users/dp/Desktop/current Project/NeedDepartmentalStore/app/build/intermediates/multi-dex/release/componentClasses.jar]
Copying resources from program jar [/Users/dp/Desktop/current Project/NeedDepartmentalStore/app/build/intermediates/transforms/jarMerging/release/jars/1/1f/combined.jar]
: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:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
Error: at java.util.zip.InflaterInputStream.<init>(InflaterInputStream.java:88)
Error: at java.util.zip.ZipFile$ZipFileInflaterInputStream.<init>(ZipFile.java:393)
Error: at java.util.zip.ZipFile.getInputStream(ZipFile.java:374)
Error: at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:270)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
Error: at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
Error: at com.android.dx.command.dexer.Main.processOne(Main.java:672)
Error: at com.android.dx.command.dexer.Main.processAllFiles(Main.java:569)
Error: at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
Error: at com.android.dx.command.dexer.Main.run(Main.java:275)
Error: at com.android.dx.command.dexer.Main.main(Main.java:245)
Error: at com.android.dx.command.Main.main(Main.java:106)
: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.8.0_73.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
Information:BUILD FAILED
Information:Total time: 4 mins 2.184 secs
Information:15 errors
Information:0 warnings
Information:See complete output in console
以下是app.gradle文件
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
applicationId "com.dp.needdepartmentalstore"
minSdkVersion 14
targetSdkVersion 23
versionCode 28
versionName "5.15"
multiDexEnabled true
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "16c778cf-8ebc-47a8-9ba8-6815f0223a0e",
onesignal_google_project_number: "253919422974"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile('com.mikepenz:actionitembadge:3.1.8@aar') {
transitive = true
}
compile('com.weiwangcn.betterspinner:library-material:1.1.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile project(':niceSpinner')
compile files('libs/PGSDK_v1.0.jar')
compile files('libs/App42_ANDROID_SDK_3.8.jar')
// compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
// transitive = true;
// }
// compile('com.instabug.library:instabugsupport:1+') {
// exclude group: 'com.mcxiaoke.volley', module: 'library'
// }
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.bignerdranch.android:expandablerecyclerview:2.0.3'
compile 'com.marshalchen.ultimaterecyclerview:library:0.3.18'
compile 'com.miguelcatalan:materialsearchview:1.3.0'
compile 'com.wdullaer:materialdatetimepicker:2.0.2'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.google.android.gms:play-services-analytics:9.0.0'
//compile 'com.onesignal:OneSignal:2.+@aar'
compile 'com.daimajia.swipelayout:library:1.2.0@aar'
compile 'com.intuit.sdp:sdp-android:1.0.2'
compile 'com.google.android.gms:play-services-maps:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
下面是我的高级gradle文件
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我无法解决此错误。请帮助解决此错误
答案 0 :(得分:3)
你能试试吗, 将其添加到 android 标记内的app.gradle文件中,然后尝试
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
答案 1 :(得分:2)
解决方案在您的错误文本中。
要在进程中运行dex,Gradle守护程序需要更大的堆。它 目前大约有910 MB。为了更快的构建,增加 Gradle守护程序的最大堆大小超过2048 MB。去做 在项目中设置org.gradle.jvmargs = -Xmx2048M gradle.properties。