2017-12-20 5 views
0

Ich habe Fehler nicht möglich Dex in meinem Projekt zusammenführen. i angewendet unterschiedliche Antworten von Stackoverflow wie:Konnte nicht verschmelzen multidex Ausführung fehlgeschlagen

defaultConfig { 
    multiDexEnabled true 
} 
dependencies { 
    compile 'com.android.support:multidex:1.0.1'} 
<application 
    android:name="android.support.multidex.MultiDexApplication" 

und manifestieren sich als well.i gereinigt Projekt und werden bereits alle anderen Option werden von den Benutzern in den Antworten zur Verfügung gestellt Rebuild/MakeProject angewendet, sondern diese Fehler. Wenn ich Multidex aktivieren, dann habe ich eine Liste von Fehlern Konvertierung von Byte nach Dex. Ich weiß nicht, was ich daran vermisse. hier ist mein App Gradle

apply plugin: 'com.android.application' 
android { 
    compileSdkVersion 23 
    buildToolsVersion "24.0.2" 
    defaultConfig { 
     applicationId "com.example.hp_pc.cerv" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    dexOptions { 
     preDexLibraries = false 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/ASL2.0' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/DEPENDENCIES' 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1' 
// compile files('libs/httpclient-4.2.3.jar') 
// compile files('libs/httpmime-4.3.jar') 
// compile files('libs/httpcore.jar') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.mcxiaoke.volley:library:1.0.+' 
    compile 'com.github.pinball83:masked-edittext:1.0.3' 
    // compile 'com.google.android.gms:play-services-maps:9.8.0' 
    compile 'com.android.support:design:23.4.0' 
    compile 'com.wdullaer:materialdatetimepicker:2.5.0' 
    compile 'com.google.android.gms:play-services:6.5.87' 
    compile 'joda-time:joda-time:2.9.4' 
    testCompile 'junit:junit:4.12' 
} 

und hier ist mein Projekt Gradle

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

buildscript { 
    repositories { 
     jcenter() 
     maven { 
      url 'https://maven.google.com/' 
      name 'Google' 
     } 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.1' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 
allprojects { 
    repositories { 
     jcenter() 
     google() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 
+0

Einmal sauber und neu erstellen Ihr Projekt –

+0

@FenilPatel habe ich das oft sogar ich auch gelöscht .gradle –

+0

@FenilPatel wenn i Projekt gereinigt es keine Fehler zeigen, als ich Projekt ausführen es gibt mir, dass Fehler –

Antwort

0

Wenn Sie mit Google-Service dann Projekt gradle wie this-

aussehen sollte
// 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:3.0.1' 
     classpath 'com.google.gms:google-services:3.0.0' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     google() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

Und für die Handhabung des Multidexing und mit Google-Service Ihre App gradle wie this-

aussehen sollte
apply plugin: 'com.android.application' 
android { 
    compileSdkVersion 23 
    buildToolsVersion "24.0.2" 
    defaultConfig { 
     applicationId "com.example.hp_pc.cerv" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     multiDexEnabled true 
    } 
    dexOptions { 
     preDexLibraries = false 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/ASL2.0' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/DEPENDENCIES' 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1' 
// compile files('libs/httpclient-4.2.3.jar') 
// compile files('libs/httpmime-4.3.jar') 
// compile files('libs/httpcore.jar') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.mcxiaoke.volley:library:1.0.+' 
    compile 'com.github.pinball83:masked-edittext:1.0.3' 
    // compile 'com.google.android.gms:play-services-maps:9.8.0' 
    compile 'com.android.support:design:23.4.0' 
    compile 'com.wdullaer:materialdatetimepicker:2.5.0' 
    compile 'com.google.android.gms:play-services:6.5.87' 
    compile 'joda-time:joda-time:2.9.4' 
    testCompile 'junit:junit:4.12' 
} 

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

Und fügen diese beiden Zeilen in Ihre AndroidManifest Datei in tag-

<application 
    android:hardwareAccelerated="true" 
    android:largeHeap="true" 

hoffe, es wird Ihr Problem lösen.

+0

jetzt habe ich Fehler Google -Service Json fehlt –

+0

Fügen Sie die Datei google-services.json hinzu, um dies zu beheben, Sie haben diese Datei verpasst. Fügen Sie es dem app/Verzeichnis hinzu. Folgen Sie diesem Link: https://support.google.com/firebase/answer/7015592 –

+0

Ich verwende keine Firebase in diesem Projekt, ich verwende nur Google Maps und Standort-APIs. IDK, warum es nach JSON-Service-Datei fragt –

Verwandte Themen