DexArchiveBuilderException

时间:2018-02-15 08:37:14

标签: android android-gradle

我知道这个问题已经被问到,但是那里提供的解决方案对我不起作用,我不能冒险使用d8编译器进行构建。这是错误:

<?php 
$getLabel = $_item->getLabel();
if (strpos($getLabel, 'price')!== false) :?>
    <a class="multi-select unselected" href="<?php echo $this->urlEscape($_item->getUrl()) ?>">

        <?php 
        $getValue = $_item->getValue();
            $fitlerPrices = str_replace('-', ' - ', $getValue);


            $file = basename($fitlerPrices); 

            $parts = explode("-", $file); 
            $getCurency = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
            $priceBefore = $getCurency . number_format($parts[0], 0);
            $priceAfter = $getCurency . number_format($parts[1], 0); ?>
            <?php
                if($i == $count){
                    //item terakhir  
                    echo '<span class="price">' . $priceBefore . 'and Above</span>';
                }elseif($i <= 1){
                    //item pertama  
                    echo '<span class="price">Below ' . $priceAfter . '</span>';
                }else{
                     echo '<span class="price">' . $priceBefore . ' - ' .$priceAfter . '</span>';
                }
            ?>

        </a>
<?php else :?>

    <a class="multi-select unselected" href="<?php echo $this->urlEscape($_item->getUrl()) ?>"><?php echo $_item->getLabel(); ?></a>
<?php endif?>

Gradle文件:

Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process E:\suv\Projects\SoundRecorder\ImageFetcher\app\build\intermediates\classes\debug
Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process E:\suv\Projects\SoundRecorder\ImageFetcher\app\build\intermediates\classes\debug
Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing Services/MyFirebaseInstanceIDService.class
Error:com.android.dx.cf.iface.ParseException: class name (services/MyFirebaseInstanceIDService) does not match path (Services/MyFirebaseInstanceIDService.class)

请帮我解决这个问题。

编辑:在尝试修复它时,我做了#34;清理项目&#34;又出现了一个错误:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "ops.com.imagefetcher"
        minSdkVersion 15
        targetSdkVersion 26
        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(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.firebase:firebase-messaging:11.0.4'
    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'

}


apply plugin: 'com.google.gms.google-services'

3 个答案:

答案 0 :(得分:7)

做完干净的构建后我得到了错误:

execution failed for task ':app:clean'.
> Unable to delete directory: E:\suv\Projects\SoundRecorder\ImageFetcher\app\build\intermediates\classes\debug

然后我尝试从android studio手动删除包但它显示了一些IOException错误。然后我做的是:我关闭了Android工作室并手动删除了调试文件夹,来自&#34; MyComputer / ThisPC&#34;通过遵循错误路径。在此修复之后,android studio成功创建了构建。

答案 1 :(得分:2)

路径中的大小写不匹配:

<强>取值 ervices / MyFirebaseInstanceIDService

<强>取值 ervices / MyFirebaseInstanceIDService.class

答案 2 :(得分:1)

in gradle

android {
    compileSdkVersion 26
    defaultConfig {
        multiDexEnabled true
    }
}