编译Android项目

哪里不对? 我不能编译项目,并得到错误:

错误:任务’:app:transformClassesWithDexForGoogleDebug’的执行失败。

com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:执行java进程时出错主类com.android.dx.command.Main带参数{–dex –force-jumbo –num-threads = 4 –multi-dex –main-dex-list C:\ Users \ andre \ Desktop \ MYproject \ app \ build \ intermediates \ multi-dex \ google \ debug \ maindexlist.txt –output C:\ Users \ andre \ Desktop \ MYproject \ app \ build \ intermediates \ transforms \ dex \ google \ debug \ folders \ 1000 \ 1f \ main C:\ Users \ andre \ Desktop \ MYproject \ app \ build \ intermediates \ transforms \ jarMerging \ google \ debug \ jars \ 1 \ 1f \ combined.jar}

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'com.google.firebase.firebase-perf' android { compileSdkVersion 26 buildToolsVersion '26.0.1' defaultConfig { applicationId "com.gvarani.myproject" minSdkVersion 17 targetSdkVersion 26 versionCode 15 versionName "1.0" vectorDrawables.useSupportLibrary = true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true //important } useLibrary 'org.apache.http.legacy' signingConfigs { release } buildTypes { debug { minifyEnabled false shrinkResources false } release { signingConfig signingConfigs.release minifyEnabled true shrinkResources true useProguard true proguardFiles getDefaultProguardFile('proguard-android.txt'), getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard/proguard-project.pro' } } sourceSets { main.java.srcDirs += 'src/main/kotlin' } flavorDimensions "release" productFlavors { google { dimension "release" } other { dimension "release" } } dexOptions { javaMaxHeapSize "2g" jumboMode true } } ext { supportLibVersion = '26.0.0' gmsVersion = '11.0.4' } dependencies { googleCompile "com.google.firebase:firebase-crash:${gmsVersion}" googleCompile "com.google.firebase:firebase-messaging:${gmsVersion}" googleCompile "com.google.firebase:firebase-auth:${gmsVersion}" googleCompile 'com.anjlab.android.iab.v3:library:1.0.42' compile "com.android.support:appcompat-v7:${supportLibVersion}" compile "com.android.support:cardview-v7:${supportLibVersion}" compile "com.android.support:design:${supportLibVersion}" compile "com.android.support:customtabs:${supportLibVersion}" compile "com.google.firebase:firebase-perf:${gmsVersion}" compile "com.google.firebase:firebase-database:${gmsVersion}" compile "com.google.firebase:firebase-ads:${gmsVersion}" compile 'com.firebaseui:firebase-ui-auth:2.2.0' compile 'com.firebaseui:firebase-ui-database:2.2.0' compile 'com.google.code.gson:gson:2.8.1' compile 'dev.dworks.libs:volleyplus:0.1.4' compile 'cat.ereza:customactivityoncrash:2.1.0' compile 'com.github.PhilJay:MPAndroidChart:v3.0.2' compile 'org.fabiomsr:moneytextview:1.1.0' compile 'com.zsoltsafrany:needle:1.0.0' compile 'com.github.lykmapipo:local-burst:v0.2.0' compile 'com.github.javiersantos:AppUpdater:2.6.1' compile 'de.psdev.licensesdialog:licensesdialog:1.8.2' compile 'org.jsoup:jsoup:1.10.3' compile 'com.wordplat:ikvStockChart:0.1.5' compile 'com.android.support:multidex:1.0.0' //Kotlin dependencies compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" } apply plugin: 'com.google.gms.google-services 

请尝试下面的代码

 android{ defaultConfig { // Enabling multidex support. multiDexEnabled true } dexOptions { javaMaxHeapSize "4g" } } dependencies { //... compile 'com.android.support:multidex:1.0.0' } 

**希望这将有助于**

把下面的行放在build.gradle;

 multiDexEnabled true 

喜欢这个:

 defaultConfig { applicationId "yourProjectPackage" minSdkVersion 15 versionCode 1 versionName "1.0" targetSdkVersion 23 multiDexEnabled true //important } 

在manifest.xml文件中添加后续代码:

    

将下面的行添加到您的应用程序build.gradle

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

在项目级gradle中添加maven {url“ https://maven.google.com ”}

 allprojects { repositories { jcenter() maven { url "https://maven.google.com" } } }