Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 生成调试apk时无法合并dex错误_Java_Android_Android Studio - Fatal编程技术网

Java 生成调试apk时无法合并dex错误

Java 生成调试apk时无法合并dex错误,java,android,android-studio,Java,Android,Android Studio,当我构建调试应用程序时,我遇到了这个问题!请帮忙 错误:任务“:app:transformDexArchiveWithExternalLibsDexMergerForDebug”的执行失败 java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex 我的Gradle文件- apply plugin: 'com.android.

当我构建调试应用程序时,我遇到了这个问题!请帮忙

错误:任务“:app:transformDexArchiveWithExternalLibsDexMergerForDebug”的执行失败

java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex

我的Gradle文件-

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId 'com.test.thing'

        manifestPlaceholders = [onesignal_app_id               : "test",
                                // Project number pulled from dashboard, local value is ignored.
                                onesignal_google_project_number: "REMOTE"]
        minSdkVersion 15
        targetSdkVersion 26


    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    repositories {
        jcenter()
        mavenCentral()  // GPUImage for Android
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile files('libs/acra-4.5.0.jar')
    compile files('libs/ormlite-android-4.43.jar')
    compile files('libs/ormlite-core-4.43.jar')
    // If you want to use the GPU Filters

    compile 'com.android.support:support-v4:24.2.1'
    compile 'com.android.support:appcompat-v7:24.2.1'
    compile 'com.android.support:design:24.2.1'
    compile 'com.android.support:cardview-v7:24.2.1'
    compile 'com.google.firebase:firebase-ads:10.0.0'
    compile 'com.google.firebase:firebase-messaging:10.0.0'
    compile 'com.loopj.android:android-async-http:1.4.9'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'jp.wasabeef:glide-transformations:2.0.1'
    compile 'com.onesignal:OneSignal:[3.5.3,4.0.0)'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'

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

`

如果必须显式地为API启用Multidex,则应启用Multidex 在五月的情况下,我这样做,它的工作很好 和快速文件

  <application
    android:allowBackup="true"
    android:icon="@drawable/logo_ew"
    android:label="Darzee.co"
    android:roundIcon="@drawable/logo_ew"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:label,android:icon"
    android:name="myapp">
    <activity android:name=".Starter.Loader">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

请包含完整日志。这只是完整错误。我已更新了我的Gradle文件,请检查并尝试此答案:在清单中添加此行时出现红色错误android:name=“android.support.multidex.MultiDexApplication”>将尝试此操作并通知您。提前谢谢
dependencies {
  compile 'com.android.support:multidex:1.0.1'
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapp">
    <application
            android:name="android.support.multidex.MultiDexApplication" >
        ...
    </application>
</manifest>
apply plugin: 'com.android.application'



android {

compileSdkVersion 27
defaultConfig {
    applicationId "com.taggroup.www.myapp"
    minSdkVersion 18
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
}
dexOptions {
    javaMaxHeapSize "4g"
}
buildTypes {
    release {
        minifyEnabled false
        multiDexEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        multiDexKeepFile file('multidex-config.txt')
    }
      }
  } 
dependencies {

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.firebase:firebase-ads:11.8.0'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
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.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.github.bumptech.glide:glide:4.2.0'
implementation 'com.android.volley:volley:1.1.0-rc1'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.paypal.sdk:paypal-android-sdk:2.15.3'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.1'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.firebase:firebase-core:11.8.4'
implementation 'com.github.amigold.fundapter:library:1.0'
implementation 'org.apache.httpcomponents:httpclient:4.3.5'
implementation files('./2checkout-java.jar')
}









apply plugin: 'com.google.gms.google-services'
  <application
    android:allowBackup="true"
    android:icon="@drawable/logo_ew"
    android:label="Darzee.co"
    android:roundIcon="@drawable/logo_ew"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:label,android:icon"
    android:name="myapp">
    <activity android:name=".Starter.Loader">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
package ...........;

import android.content.Context;
import android.os.Bundle;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import android.support.v7.app.AppCompatActivity;

import com.google.firebase.crash.FirebaseCrash;



public class myapp extends MultiDexApplication  {
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}

}