2017-01-30 69 views
1

我想與我通過我的gradle這個Android應用程序集成的應用程序性能監控工具無法說錯誤同時整合AppDynamics:transformClassesWithMultidexlistForLiveDebug

Error:Execution failed for task ':app:transformClassesWithMultidexlistForLiveDebug'. 
> java.util.NoSuchElementException (no error message) 

下面是我的gradle這個根gradle這個文件

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.3' 
     classpath 'com.appdynamics:appdynamics-gradle-plugin:4.+' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

這裏是我的App的gradle文件,

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 


    defaultConfig { 
     applicationId "com.app.abc" 
     minSdkVersion 14 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1" 
     multiDexEnabled true 
    } 

    dexOptions { 
     preDexLibraries = false 
     javaMaxHeapSize "4g" 
    } 

    signingConfigs { 
     config { 
      keyAlias 'xxx' 
      keyPassword 'xxx' 
      storeFile file('xxx') 
      storePassword 'xxx' 
     } 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
     } 
     debug { 
      debuggable true 
      minifyEnabled false 
     } 
    } 

    afterEvaluate { 
     tasks.matching { 
      it.name.startsWith('dex') 
     }.each { dx -> 
      if (dx.additionalParameters == null) { 
       dx.additionalParameters = [] 
      } 
      dx.additionalParameters += "--set-max-idx-number=55000" 
     } 
    } 

    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES.txt' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/notice.txt' 
     exclude 'META-INF/license.txt' 
     exclude 'META-INF/dependencies.txt' 
     exclude 'META-INF/LGPL2.1' 
    } 

    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 
    } 

    sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } } 
} 

dependencies { 
    ... 
    compile 'com.appdynamics:appdynamics-runtime:4.+' 
} 

我是已經啓用了Multidex標誌,但它在運行應用程序時仍然會出現問題。

而且,我也有我的應用程序類

@Override 
    protected void attachBaseContext(Context base) { 
     super.attachBaseContext(base); 
     MultiDex.install(this); 
    } 

回答

0

我已經嘗試添加多DEX沒有每DEX文件wise.I've試圖用單純只是增加multidex給人方法計數的最小或最大並能夠build.And是!我也可以構建應用程序。

重大變化在afterEvaluate & incremental truedexoption

的build.gradle

android { 
    compileSdkVersion 23 
    buildToolsVersion '23.0.3'  
    defaultConfig { 
     minSdkVersion 14 
     targetSdkVersion 18 
     renderscriptTargetApi 18 
     //renderscriptSupportModeEnabled true 
     // To enable MultiPle dex 
     multiDexEnabled true 
    } 
    dexOptions { 
     // Option to handle multi dex 
     incremental true 
     javaMaxHeapSize "4g" // try with 2g as it worked for my case its working in both cases 
     // here 4g i got this thing from https://groups.google.com/forum/#!topic/adt-dev/P_TLBTyFWVY 
    } 
    packagingOptions { 

     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/NOTICE' 

    } 
    signingConfigs { 
     Release { 
      keyAlias 'helloworld' 
      keyPassword 'helloworld' 
      storeFile file('../helloworld') 
      storePassword 'helloworld' 
     } 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 
        'proguard-project.txt' 
     } 
     debug { 
      signingConfig signingConfigs.Release 
     } 
    } 
} 


dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 

     compile 'com.android.support:multidex:1.0.1' 
    compile 'com.android.support:appcompat-v7:23.3.0' 
    compile 'com.android.support:design:23.3.0' 

    compile 'com.google.android.gms:play-services-maps:8.4.0' 
    compile 'com.google.android.gms:play-services-ads:8.4.0' 
    compile 'com.google.android.gms:play-services-analytics:8.4.0' 
    compile 'com.google.code.gson:gson:2.6'  
    compile 'com.github.bumptech.glide:glide:3.7.0' 
    compile 'com.github.bumptech.glide:okhttp3-integration:[email protected]' 
    compile 'com.squareup.okhttp3:okhttp:3.2.0'  
    compile 'com.appdynamics:appdynamics-runtime:4.+' 
} 
afterEvaluate { 
    tasks.matching { 
     it.name.startsWith('dex') 
    }.each { dx -> 
     if (dx.additionalParameters == null) { 
      dx.additionalParameters = [] 
     } 
     dx.additionalParameters += '--multi-dex' // enable multidex without giving minimum or maximum limit 
    } 
} 

應用程序的父gradle這個

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.2.3' 
     classpath 'com.appdynamics:appdynamics-gradle-plugin:4.+' 
     // 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 
} 

如果上面的東西都還只是出具檢查你的依賴條件的層次結構,如果在添加任何其他額外的依賴條件(您build.gradle 基於那裏應該有一些其他的依賴)。不確定,但可能因爲內部庫衝突而不可能進一步創建dexfile或建立。

讓我知道是否有任何東西