Problem Android Build transformDexArchiveWithExternalLibsDexMergerForDebug hung

1

I have an Android project which when running the build takes approximately 10 hours (and adding) executing the task:

app:transformDexArchiveWithExternalLibsDexMergerForDebug

I imagine this is not normal, what can you owe? and what can I do to correct it?

At the moment I have detected that the problem is associated with an external lib that I need to use since when removing it the build ends in no more than 2 minutes.

The lib that I am trying to use is the "org.apache.tika" .

This is my build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "gvideo.sgutierc.cl.videorecorder"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:cardview-v7:27.0.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.google.android.gms:play-services:11.8.0'
    implementation 'com.android.support:mediarouter-v7:27.0.1'
    implementation 'com.android.support:design:27.0.1'
    implementation 'com.android.support:support-v13:27.0.1'
    implementation group: 'org.apache.tika', name: 'tika-parsers', version: '1.14'
    api files('libs/lib.file.metadata.jar')
}
    
asked by Androide203 24.04.2018 в 20:58
source

1 answer

0

In this case, when compiling your application it seems that it reaches the 64Kb reference limit, it adds the multiDexEnabled = true property within

android {
    ...
    defaultConfig {
     ...
      multiDexEnabled true
     ...
    }
}

Review the documentation about:

Set apps with methods over 64K

  

About the 64K reference limit The Android apps files (APK) contain executable byte code files in   form of Dalvik Executable (DEX) files, which contain the code   compiled employee to run your app. The Dalvik specification   Executable limits the total number of methods that can be   reference in a Dex file to 65 536, including the methods of the   Android framework, library and your own code. At   In the context of computer science, the term Kilo, K, denotes 1024 (or 2 ^ 10).   Because 65 536 equals 64 X 1024, this limit is called   "64K reference limit"

Update:

  

I have an Android project which when running the build takes   approximately 10 hours (and adding) executing the task.

To compile a project this should not take so long if this is happening, it should for the following reasons.

  • You do not have an internet connection. This to lower the dependencies specified in your build.gradle .
  • You are under a proxy, you need to add the credentials.

  • Sometimes the proxy server determines to block some urls which are necessary to download data, even if you add your credentials, I suggest you check the Android Studio Log to check which url is the problem:

    
answered by 24.04.2018 в 21:16