2017-11-01 17 views
0

私は最近、アンドロイドアプリケーションのgradleプラグインを2.3.3から3.0.0にアップグレードしました。コンパイルの問題のほとんどを解決した後、私はまだ次の例外に悩まさよ:Gradle Plugin 3.0への移行後のDexArchiveBuilderExceptionのコンパイル

com.android.build.api.transform.TransformException: 
com.android.builder.dexing.DexArchiveBuilderException: 
com.android.builder.dexing.DexArchiveBuilderException: 
Failed to process /Users/{user}/SourceCode/Android/{project_path}/build/intermediates/transforms/profilers-transform/debug/113.jar 

{user}{project_path}フィールドは、実際の値のプレースホルダです。

何が起こっているのかは完全にはわかりませんが、スタックトレースの外観から、ビルドがサードパーティのSDM(Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing com/outbrain/OBSDK/HttpClient/OBHttpClient.class)のいずれかをデクスすることに失敗しています。奇妙なことは、内部的にプロジェクトをビルドしたり、デバッグとリリースの両方のためにapkをビルドして生成すると、ビルドが期待通りに機能するということです。私がこのエラーを受け取ったエミュレータにアプリケーションをデプロイしようとするときだけです。

このエラーがなぜ発生しているかについての洞察は非常に高く評価されます。

注:私はGoogle Doc(https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html)を参照しましたが、この問題に関しては何も表示されません。

は、ここで関連するスタックトレースの出力です:

Caused by: com.android.builder.dexing.DexArchiveBuilderException: Failed to process /Users/{user}/SourceCode/Android/{project_path}/build/intermediates/transforms/profilers-transform/debug/113.jar 
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:550) 
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.lambda$convertToDexArchive$1(DexArchiveBuilderTransform.java:488) 
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424) 
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) 
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) 
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) 
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) 

Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing com/outbrain/OBSDK/HttpClient/OBHttpClient.class 

at com.android.builder.dexing.DxDexArchiveBuilder.getExceptionToRethrow(DxDexArchiveBuilder.java:143) 
at com.android.builder.dexing.DxDexArchiveBuilder.convert(DxDexArchiveBuilder.java:89) 
at com.android.build.gradle.internal.transforms.DexArchiveBuilderTransform.launchProcessing(DexArchiveBuilderTransform.java:545) 
... 6 more 

Caused by: com.android.dx.cf.code.SimException: stack: underflow 
at com.android.dx.cf.code.ExecutionStack.throwSimException(ExecutionStack.java:341) 
at com.android.dx.cf.code.ExecutionStack.peek(ExecutionStack.java:206) 
at com.android.dx.cf.code.ExecutionStack.peekType(ExecutionStack.java:241) 
at com.android.dx.cf.code.Simulator$SimVisitor.visitNoArgs(Simulator.java:427) 
at com.android.dx.cf.code.BytecodeArray.parseInstruction(BytecodeArray.java:584) 
at com.android.dx.cf.code.Simulator.simulate(Simulator.java:103) 
at com.android.dx.cf.code.Ropper.processBlock(Ropper.java:790) 
at com.android.dx.cf.code.Ropper.doit(Ropper.java:745) 
at com.android.dx.cf.code.Ropper.convert(Ropper.java:350) 
at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:309) 
at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:150) 
at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:102) 
at com.android.builder.dexing.DxDexArchiveBuilder.dex(DxDexArchiveBuilder.java:107) 
at com.android.builder.dexing.DxDexArchiveBuilder.convert(DxDexArchiveBuilder.java:86) 
... 7 more 

編集:追加プロジェクトのbuild.gradleの質問に。注意:機密情報を追加しましたプレースホルダ:

// Top-level build file where you can add configuration options common to all sub-projects/modules. 
allprojects { 
    repositories { 
     jcenter() 
     maven { 
      url 'http://dl.bintray.com/optimizely/optimizely' 
     } 
    } 
} 

buildscript { 
    repositories { 
     jcenter() 
     maven { 
      url 'https://maven.fabric.io/public' 
     } 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0' 

     // The Fabric Gradle plugin uses an open ended version to 
     // react quickly to Android tooling updates 
     classpath 'io.fabric.tools:gradle:1.+' 

     classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1' 

     // Kotlin Support 
     classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51' 
    } 
} 

apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 
apply plugin: 'com.jakewharton.hugo' 
apply plugin: 'kotlin-android' 

repositories { 
    jcenter() 
    maven { 
     url 'https://maven.fabric.io/public' 
    } 
    maven { 
     url "http://appboy.github.io/appboy-android-sdk/sdk" 
    } 
    maven { 
     url "http://dl.bintray.com/teads/TeadsSDK-android" 
    } 
    maven { 
     url "https://jitpack.io" 
    } 
    flatDir { 
     dirs 'libs' 
    } 
    google() 
} 

// Test Dependencies 
dependencies { 
    testCompile 'junit:junit:4.12' 
    testCompile 'org.mockito:mockito-core:1.10.19' 
    testCompile 'org.robolectric:robolectric:3.0' 
    testCompile 'org.robolectric:shadows-multidex:3.0' 
    testCompile 'org.robolectric:shadows-play-services:3.0' 
    testCompile 'org.easytesting:fest-assert-core:2.0M10' 
    // testCompile 'org.easytesting:fest-assert:1.4' 
    testCompile 'org.powermock:powermock-module-junit4:1.6.4' 
    testCompile 'org.powermock:powermock-module-junit4-rule:1.6.4' 
    testCompile 'org.powermock:powermock-api-mockito:1.6.4' 
    testCompile 'org.powermock:powermock-classloading-xstream:1.6.4' 
} 

dependencies { 

    def appCompatVersion = "25.3.1" 
    def playServicesVersion = "11.0.4" 

    compile project(':BRShared') 
    compile project(':CastCompanionLibrary-android') 
    wearApp project(':wear') 

    compile fileTree(dir: 'libs', include: '*.jar') 

    compile(name: 'sharethrough-android-sdk-v4.4.0', ext: 'aar') 
    compile('com.optimizely:optimizely:[email protected]') { 
     transitive = true 
    } 

    compile 'com.android.volley:volley:1.0.0' 
    compile "com.google.android.gms:play-services:$playServicesVersion" 

    compile "com.android.support:support-v4:$appCompatVersion" 
    compile "com.android.support:appcompat-v7:$appCompatVersion" 
    compile "com.android.support:design:$appCompatVersion" 
    compile "com.android.support:cardview-v7:$appCompatVersion" 
    compile "com.android.support:recyclerview-v7:$appCompatVersion" 
    compile "com.android.support:customtabs:$appCompatVersion" 
    compile 'com.android.support:support-v4:19.1.0' 
    compile 'com.android.support:multidex:1.0.1' 

    compile('com.twitter.sdk.android:tweet-ui:[email protected]') { 
     transitive = true; 
    } 
    compile('com.twitter.sdk.android:twitter-core:[email protected]') { 
     transitive = true; 
    } 

    compile 'com.squareup.okhttp3:okhttp:3.4.2' 
    compile 'com.squareup.picasso:picasso:2.5.2' 

    compile 'com.appboy:android-sdk-ui:1.19.0' 

    // Facebook 
    compile 'com.facebook.stetho:stetho:1.3.0' 
    compile 'com.facebook.android:audience-network-sdk:4.26.0' 
    compile 'com.facebook.android:facebook-android-sdk:4.27.0' 

    // Inneractive SDK 
    compile(name: 'ia-mraid-kit-release-7.0.5', ext: 'aar') 
    compile(name: 'ia-native-kit-release-7.0.5', ext: 'aar') 
    compile(name: 'ia-sdk-core-full-release-7.0.5', ext: 'aar') 
    compile(name: 'ia-video-kit-release-7.0.5', ext: 'aar') 


    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
    compile('com.crashlytics.sdk.android:crashlytics-ndk:[email protected]') { 
     transitive = true; 
    } 

    compile 'com.jakewharton:butterknife:7.0.1' 

    compile 'com.google.code.gson:gson:2.2.4' 
    compile 'com.outbrain.obsdk:obsdk:2.1.1' 
    compile 'org.jetbrains.kotlin:kotlin-stdlib:1.1.3' 
    compile files('libs/bluekai.jar') 

    // Reactive 
    compile 'io.reactivex:rxjava:1.3.0' 
    compile 'io.reactivex:rxandroid:1.2.1' 

    // ExoPlayer 
    compile 'com.google.android.exoplayer:exoplayer:r2.4.0' 

    // AdobePass 
    compile files('libs/novacorps-adobepass-client-1.1.0.jar') 
    compile files('libs/nebula-config-1.3.0.jar') 

    // Needed in libs directory to avoid missing MVPD model compile error 
    compile files('libs/android_accessenabler-1.9.1.jar') 

    // Android Spin Kit UI 
    compile 'com.github.ybq:Android-SpinKit:1.1.0' 

    // Teads SDK 
    compile ('tv.teads.sdk:androidsdk:2.4.14:[email protected]') { 
     transitive = true; 
    } 

    // Material Ripple Layout 
    compile 'com.balysv:material-ripple:1.0.2' 

    compile 'org.aspectj:aspectjrt:1.8.1' 

    // Moshi - JSON Object Mapping 
    compile 'com.squareup.moshi:moshi:1.5.0' 

    // GIF Image Library - For Animations 
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.8' 
} 

android { 
    compileSdkVersion project.compile_sdk_version.toInteger() 
    buildToolsVersion project.build_tools_version 
    useLibrary 'org.apache.http.legacy' 
    defaultConfig { 
     applicationId {application_id} 
     multiDexEnabled true 
     vectorDrawables.useSupportLibrary = true 
     versionCode 31500100 
     versionName {version_name} 
     ndk { 
      abiFilters "armeabi-v7a", "x86" 
     } 
     minSdkVersion 19 

     javaCompileOptions { 
      annotationProcessorOptions { 
       includeCompileClasspath true 
      } 
     } 
    } 
    signingConfigs { 
     release { 
      keyAlias {key_alias} 
      keyPassword {key_password} 
      storeFile file({file_name}) 
      storePassword {store_password} 
     } 
    } 

buildTypes { 
     debug { 
      minifyEnabled false 
      applicationIdSuffix '.debug' 
      versionNameSuffix '-DEBUG' 
      debuggable true 

      buildConfigField "boolean", "DEBUG_FORCE_UNICORN_OFF", "false" 
      buildConfigField "boolean", "DEBUG_STETHO", "true" 

      // These are the values for the authorities and account types. 
      resValue "string", "account_type", "{application_id}.debug.accounttype" 
      resValue "string", "authority", "{application_id}.debug" 

      resValue "string", "about_version_build", defaultConfig.versionName 
      resValue "string", "about_version_suffix", "debug" 
      resValue "string", "outbrain_test_mode", "true" 
      resValue "bool", "enable_view_server", "true" 
      resValue "bool", "hockey_app_auto_upload", "false" 

      resValue "string", "base_feed_url", {base_feed_url} 
      resValue "string", "path_config", "xmldata/configuration-androidtest" 

      resValue "string", "google_now_check_credentials_url", "{google_check_credentials_url}" 
      resValue "string", "google_now_add_credentials_url", "{google_add_credentials_url}" 
      resValue "string", "google_now_add_activity_url", "{google_add_activity_url}" 

      resValue "string", "com_appboy_push_gcm_sender_id", "{sender_id}" 
      resValue "string", "com_appboy_api_key", "{api_key}" 
     } 
     release { 
      ext.enableCrashlytics = true 
      minifyEnabled false 
      debuggable false 
      signingConfig signingConfigs.release 

      buildConfigField "boolean", "DEBUG_FORCE_UNICORN_OFF", "false" 
      buildConfigField "boolean", "DEBUG_STETHO", "false" 

      // Reference them again so they get overwritten by the flavor. 
      resValue "string", "account_type", "{application_id}.accounttype" 
      resValue "string", "authority", "{application_id}" 

      resValue "string", "about_version_build", defaultConfig.versionName 
      resValue "string", "about_version_suffix", "release" 
      resValue "string", "outbrain_test_mode", "false" 
      resValue "bool", "enable_view_server", "false" 
      resValue "bool", "hockey_app_auto_upload", "true" 

      resValue "string", "base_feed_url", "{base_feed_url}" 
      resValue "string", "path_config", "xmldata/configuration-androidv4" 
      resValue "string", "google_now_check_credentials_url", "{google_check_credentials_url}" 
      resValue "string", "google_now_add_credentials_url", "{google_add_credentials_url}" 
      resValue "string", "google_now_add_activity_url", "{google_add_activity_url}" 

      resValue "string", "com_appboy_push_gcm_sender_id", "{sender_id}" 
      resValue "string", "com_appboy_api_key", "{api_key}" 
     } 
     livesim { 
      ext.enableCrashlytics = true 
      versionNameSuffix '-LIVE-SIM' 
      minifyEnabled false 
      debuggable false 
      signingConfig signingConfigs.release 

      buildConfigField "boolean", "DEBUG_FORCE_UNICORN_OFF", "false" 
      buildConfigField "boolean", "DEBUG_STETHO", "false" 

      // Reference them again so they get overwritten by the flavor. 
      resValue "string", "account_type", "{application_id}.accounttype" 
      resValue "string", "authority", "{application_id}" 

      resValue "string", "about_version_build", defaultConfig.versionName 
      resValue "string", "about_version_suffix", "release" 
      resValue "string", "outbrain_test_mode", "false" 
      resValue "bool", "enable_view_server", "false" 
      resValue "bool", "hockey_app_auto_upload", "true" 

      resValue "string", "base_feed_url", "{base_feed_url}" 
      resValue "string", "path_config", "xmldata/configuration-androidv4" 
      resValue "string", "google_now_check_credentials_url", "{google_check_credentials_url}" 
      resValue "string", "google_now_add_credentials_url", "{google_add_credentials_url}" 
      resValue "string", "google_now_add_activity_url", "{google_add_activity_url}" 

      resValue "string", "com_appboy_push_gcm_sender_id", "{sender_id}" 
      resValue "string", "com_appboy_api_key", "{api_key}" 

      // Fallback for sub projects 
      matchingFallbacks = ['release'] 
     } 
    } 
    sourceSets { 
     main { 
      manifest.srcFile 'AndroidManifest.xml' 
      java.srcDirs = ['src/main'] 
      resources.srcDirs = ['src'] 
      aidl.srcDirs = ['src'] 
      renderscript.srcDirs = ['src'] 
      res.srcDirs = ['res'] 
      assets.srcDirs = ['assets'] 
     } 

     instrumentTest.setRoot('tests') 

     debug.setRoot('build-types/debug') 
     release.setRoot('build-types/release') 
     livesim.setRoot('build-types/livesim') 
    } 
    dexOptions { 
     jumboMode true 
     preDexLibraries = false 
     javaMaxHeapSize "6g" 
    } 
    lintOptions { 
     checkReleaseBuilds false 
     abortOnError false 
    } 
    testOptions { 
     unitTests.returnDefaultValues = true 
    } 
} 

android.applicationVariants.all { variant -> 
    variant.outputs.all { output -> 
     def buildType = variant.variantData.variantConfiguration.buildType.name 
     outputFileName = "{Application_Name}-" + (buildType == "release" || buildType == "livesim" ? "release-" : "") + "${variant.versionName}.apk" 
    } 
} 

dependencies { 
    compile 'com.android.support.constraint:constraint-layout:+' 
} 
+0

投稿するbuild.gradle –

+0

上記の編集に追加されました –

答えて

1

を、私は私の質問への答えを見つけたが、場合には、誰もがまだ答えを探して、私はここに私の解決策を投稿します:

をそれが判明しますAdvanced Profilingフィールドが有効になっているエミュレータ/物理デバイスにデバッグビルドをインストールしていました。これはAndroid Studio 3.0で有効になった機能で、開発者はAndroid Profilerの出力からより正確で詳細な情報を取得できます。

要件の説明は、少し誤解を招くようなものです。 APIバージョンには、 ver未満のバージョンが必要です。 26しかしそれは事実ではない(少なくとも私にとってはそうではなかった)。それは verより大きいAPIバージョンでのみ正常に構築されているようです。有効にする場合は26を選択します。アドバンストプロファイラが必要とする時間までにすべてのメソッドをフラッシュしていないが、何が起こっているかについての詳細はないようだが、更新されたMulti-Dexサポートライブラリとは関係があるかもしれない。

verよりも小さいデバイスでビルドを実行している場合は、 26(Android O)の場合は、実行コンフィギュレーション([実行コンフィギュレーションの編集]ウィンドウ内の[プロファイリング]タブにあります)のフィールドを無効にしてみてください。

Advanced Profiling Field in Run Configurations

役に立てば幸い!

関連する問題