When I try to debug my app in Android Studio I get a gradle error. I have now idea how I can fix it. Does anyone have any ideas or fixes for me so I can continue debugging my app. I googled it already and people are saying the cause could be that there are duplicate imports in the gradle file but I checked this and there are none. When I rebuilt gradle it is successful but when I debug I get this error.
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2220Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72200Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72100Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42221Library UP-TO-DATE
:app:prepareComBalysvMaterialmenuMaterialMenu154Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk460Library UP-TO-DATE
:app:prepareComGithubJohnkilAndroidRobototextviewRobototextview240Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet750Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable750Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/x/Development/Android SDK/build-tools/21.1.2/dx --dex --no-optimize --output /Users/app/app/build/intermediates/dex/debug --input-list=/Users/app/app/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 42.045 secs
My build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '3.3.2'
def JacksonVersion = '2.5.2'
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
// androidManifestFile variant.outputs[0].processResources.manifestFile
// if you have multiple outputs (when using splits), you may want to have other index than 0
// you should set your package name here if you are using different application IDs
resourcePackageName "com.app"
// You can set optional annotation processing options here, like these commented options:
// logLevel 'INFO'
// logFile '/var/log/aa.log'
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.app"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/spring.handlers'
exclude 'META-INF/spring.schemas'
exclude 'META-INF/spring.tooling'
}
}
repositories {
mavenCentral()
mavenLocal()
maven {
url 'http://repo.spring.io/milestone'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:design:22.2.0'
compile(
[group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: "$JacksonVersion"],
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: "$JacksonVersion"],
[group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "$JacksonVersion"]
)
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile "org.springframework.android:spring-android-rest-template:2.0.0.M2"
compile "com.squareup.okhttp:okhttp:2.4.0"
compile "com.squareup.okhttp:okhttp-urlconnection:2.4.0"
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.github.johnkil.android-robototextview:robototextview:2.4.0'
compile 'com.balysv.materialmenu:material-menu:1.5.4'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.google.android.gms:play-services:7.5.0'
}
It means that you reached dex methods count limit, one dex file can contain max 65536. You can try to remove redundant libraries and reduce methods count or implement multidex application and add as many methods as you want.
Here's a great example of multidex implementation with possible workarounds and tricks.
Whats your Logcat Throws
Execution failed for task ':app:dexDebug'.
some of your jar files does not compile. You should go into your build.gradle file in your project, and look in your dependencies.
Just enable multiDexEnabled true
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
See Unable to execute dex: method ID not in [0, 0xffff]: 65536
and
https://developer.android.com/studio/build/multidex.html
Related
I have a android project of e-commerce app. It is published on also app store. I have updated some thing in my app like com.google.android.gms:play-services:8.3.0 to com.google.android.gms:play-services:9.0.0. After that when i run app on local device its run perfact but when i generated Signed Apk this give error like below
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
Below is app.gradle file
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'
below is my high level gradle file
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
}
I can not solve this error. Please help to resolve this error
Can you try this,
Add this in your app.gradle file inside android tag and try
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
Original answer by Scott Barta
The solution is in your error text.
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.
I'm trying to install RoboGuice as a dependency in my Android Studio project. As soon as I attempt to run the project (even before I've added any new code), I crash with this output:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72300Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42300Library UP-TO-DATE
:app:prepareComMcxiaokeVolleyLibraryAar100Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:preDexDebug
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Ljavax/inject/Provider;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 10.274 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Here are my gradle files:
build.gradle (Module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.mysite.myapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'javax.inject:javax.inject:1'
compile 'org.roboguice:roboguice:3.+'
}
build.gradle (project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
I'm totally perplexed. Can anyone see what I am doing wrong? Thanks.
Roboguice will bring it's 'own' javax.inject as a dependency, so when you're declaring compile 'javax.inject:javax.inject:1' there's 2 of them resulting in
Multiple dex files define Ljavax/inject/Provider
Just remove the javax.inject dependency.
I have added these two new dependencies in my build.gradle
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
And right now, I can't build my project because I've got an error. I have found information about the error and the solution that I have found says that I have to add ...
compile 'com.parse.bolts:bolts-android:1.+'
To myy app.gradle. I have added, sync gradle with OK result, but when I'm going to build my Android project it doesn't works to me. Therefore, my actual build.gradle is ...
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' }
mavenCentral()
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "demo31.mobiltool"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.android.gms:play-services:6+'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile('com.twitter.sdk.android:twitter:1.5.1#aar') {
transitive = true;
}
compile 'com.google.apis:google-api-services-urlshortener:v1-rev41-1.20.0'
}
And when I try to build my Android project I've got these error ...
Information:Gradle tasks [:app:assembleDebug]
Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Warning:Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareComDigitsSdkAndroidDigits150Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk400Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices6587Library UP-TO-DATE
:app:prepareComTwitterCobaltPerformanceMetrics020Library UP-TO-DATE
:app:prepareComTwitterSdkAndroidTweetComposer074Library UP-TO-DATE
:app:prepareComTwitterSdkAndroidTweetUi120Library UP-TO-DATE
:app:prepareComTwitterSdkAndroidTwitter151Library UP-TO-DATE
:app:prepareComTwitterSdkAndroidTwitterCore134Library UP-TO-DATE
:app:prepareIoFabricSdkAndroidFabric131Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:fabricGenerateResourcesDebug
:app:processDebugResources
:app:generateDebugSources
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
**Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2**
What am I doing wrong? What have I to add or remove or modify to build my project correctly?
You need to reduce the size or include only the imports you need to for your application. You are hitting the dex limit of 65536 methods.
Here's the link Building Apps with Over 65K Methods which might help.
I am working on project called as Google Places and Maps which shows the current location and nearby places.
I added the four jar files:-
1.android-google-maps-api11.jar
2.google-api-client-1.10.3-beta.jar
3.google-http-client-1.10.3-beta.jar
4.google-play-services.jar
Its is working fine during build-gradle but throwing exception while running the project
here is what i am getting
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices6587Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:preDexDebug
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\abhi\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex -- no-optimize --output C:\android\sdk\extras\google\m2repository\com\google\android\PlacesandMaps\app\b uild\intermediates\dex\debug --input- list=C:\android\sdk\extras\google\m2repository\com\google\android\PlacesandMaps\ app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Information:BUILD FAILED
Information:Total time: 1 mins 25.598 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
And here is my Build.gradle in which dependencies are there
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.abhi.placesandmaps"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard- rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile files('libs/google-api-client-1.10.3-beta.jar')
compile files('libs/google-http-client-1.10.3-beta.jar')
compile files('libs/android-google-maps-api11.jar')
compile files('libs/google-play-services.jar')
}
Don't juse jar files from Google. Use the new aar files. Here is the bug:
compile 'com.google.android.gms:play-services:6.5.87'
compile files('libs/google-play-services.jar')
There you include the play services twice remove the jar line.
The first line in your dependencies (compile fileTree(include: ['*.jar'], dir: 'libs')) will include the jar a second time, so remove the jar file from your libs directory too.
In general I'm not sure what the other jars do, but I guess they are part of the play services.
I am develoind an android studio project , everything was ok until i added
compile 'com.android.support:recyclerview-v7:+' to build.gradle file. I have been searching for 2 days for solution but haven't find yet.
Information:Gradle tasks [:app:assembleDebug] :app:preBuild :app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72100Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72102Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42102Library UP-TO-DATE
:app:prepareComGithubMrengineer13Snackbar040Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices6171Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJava
:app:preDexDebug
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Users/mobven/Desktop/Android SDK/sdk/build-tools/21.1.0/dx --dex --output /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/dex/debug /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/classes/debug /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/dependency-cache/debug /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/android-support-4.0-96f0e9cf7990afcb0b54c3d327a3aced85a5af15.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-20f85e113689efd0f4d808bbf1312e09c43bdc49.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-440f6b09f10e8e30a1118a4d2d43be583bad0959.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-5a02f8ebc8798b4c3710b33fb2c074683173cb80.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-6989a5d493505095675afd12d6931b51cf429992.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-a6edf6fa0c3d2cb2cec1edb40923a7d765d78fb0.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/gson-2.3-7dd4601f2faeb82b5beefe363da658c9ae925581.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/internal_impl-21.0.2-1aafd0446915d1011bb9668a6ac8f1defcf9191b.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/parceler-0.2.13-68a2a9c6331b436a4224a892389405276283d547.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/parceler-api-0.2.13-1072eb832cf4d87fb253f15aa798d90ebce68715.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/picasso-2.4.0-f12467e4b369fb01d4a49695801fd3e502b511b8.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/retrofit-1.6.1-3e3f707b537476742224240911665405915f3e6d.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/support-annotations-21.0.2-8c0b808a6eea01eb2d7e9f3bb66927cb2d265768.jar Error Code: 2 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/app/BackStackRecord$Op;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
this is build.grade file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.mobven.hesapal"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.github.mrengineer13:snackbar:0.4.0'
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'com.google.code.gson:gson:2.3'
compile 'org.parceler:parceler:0.2.13'
compile files('libs/picasso-2.1.1.jar') }
Thanx in advance
Found solution
I removed
compile 'org.parceler:parceler:0.2.13'
and it started to working.I think parcelled lib is also referring supportV4 but I'm not %100 sure why it started to work or why its not working with parcelled lib.Anyway i posted solution if anyone has same problem .
Please check again libs folder, you first line at `dependencies' will include all jars from that folder. Maybe there still exists one of library from your current list of dependencies.
compile fileTree(dir: 'libs', include: ['*.jar'])