2016-04-11 19 views
0

Derlendiğinde ve hata oluştuğunda hata yaşıyorum. Ben android içinde projemi derlemek ve birçok parçaları kaldırıldı çünkü, Android < yılında 5,0[NoClassDefFoundError]

Caused by: java.lang.NoClassDefFoundError: com.squareup.okhttp.Protocol[] 

sorun "NoClassDefFoundError" olduğunu çalıştırmak ve ben başka sınıflarında aynı hatayı aldığınızda. Zaten projemi temizledim, gradlew clean'u kullandım. Ben birçok güne baktım. Lütfen bana yardım et. gradle içinde

Benim bağımlılıkları:

dependencies { 

compile fileTree(dir: 'libs', include: ['*.jar']) 
testCompile 'junit:junit:4.12' 
compile files('libs/YouTubeAndroidPlayerApi.jar') 

compile('com.facebook.android:facebook-android-sdk:[4,5)') { 
    exclude group: 'com.parse.bolts', 
      module: 'bolts-tasks' 
    exclude group: 'com.parse.bolts', 
      module: 'bolts-applinks'; 
} 

compile 'com.android.support:appcompat-v7:23.3.0' 
compile 'com.google.apis:google-api-services-youtube:v3-rev145-1.20.0' 

compile 'com.squareup.okhttp3:okhttp:3.2.0' 
compile 'com.google.android.gms:play-services-gcm:8.4.0' 
compile 'info.hoang8f:fbutton:1.0.5' 
compile 'com.victor:lib:1.0.1' 
compile 'com.melnykov:floatingactionbutton:1.3.0' 
compile 'com.google.code.gson:gson:2.4' 
compile 'com.github.amlcurran.showcaseview:library:5.3.0' 
compile 'com.amazonaws:aws-android-sdk-mobileanalytics:2.2.5' 
compile 'com.facebook.fresco:fresco:0.7.0' 
compile 'com.facebook.fresco:imagepipeline-okhttp:0.7.0' 
compile 'com.wang.avi:library:1.0.1' 
compile 'com.balysv:material-ripple:1.0.2' 
compile 'com.nineoldandroids:library:2.4.0' 
compile 'com.github.markushi:circlebutton:1.1' 
compile 'com.baoyz.pullrefreshlayout:library:1.2.0' 
compile 'com.android.support:design:23.3.0' 
compile 'com.android.support:recyclerview-v7:23.3.0' 
compile 'com.github.jd-alexander:LikeButton:0.1.8' 
compile 'com.android.support:multidex:1.0.1' 
} 

[DÜZENLE]

modül Gradle:

buildscript { 
repositories { 
    jcenter() 
    mavenCentral() 
} 
dependencies { 
    classpath 'com.android.tools.build:gradle:1.5.0' 

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

allprojects { 
    repositories { 
     jcenter() 
     maven { url "https://jitpack.io" } 
    } 
} 

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

Proje gradle geri kalanı, ben kullanıyorum tatlar ve eğer Buraya koyacağım uzun süre olacak:

defaultConfig { 
     applicationId "blacktoad.com.flapprototipo" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 20 
     versionName "1.48" 

     multiDexEnabled true 
    } 

    dexOptions { 
     javaMaxHeapSize "4g" 
     preDexLibraries = false 
     jumboMode = true 
    } 
+0

bir olağan android proje birden fazla build.gradle vardır ve build.gradle birden fazla 'dependencies' kesite sahip olabilir . Bu bağımlılık bölümünün nereye gittiğini ve kaynak dosyalarınızın nerede yaşadığını gösterir misiniz? – RaGe

+0

Kodunuzu proguard ile gizliyor musunuz? İlgili tüm kuralları eklediniz mi? – thepoosh

+0

edited, diğer birçok bilgiyi de ekledim, sadece proje ve modül graberini kullanıyorum. –

cevap

1

Sen

<application 
    ... 
    android:name="android.support.multidex.MultiDexApplication" 
    ... 
> 

Zaten tesisle isim varsa AndroidManifest.xml multidex ayarı kaçırdı uygulama etiketi, lütfen AndroidManifest.xml yerine Uygulama alanını genişleten bu sınıftaki aşağıdaki geçersiz kılma işlevini ekleyin. Tabii

@Override 
protected void attachBaseContext(Context base) { 
    super.attachBaseContext(base); 
    MultiDex.install(this); 
} 

, sen build.gradle bu kodu olmalıdır

android { 
    defaultConfig { 
     multiDexEnabled true 
    } 
} 
+0

1

Çözdüm! compile 'com.android.support:multidex:1.0.1'

Ve MainActivity I ekleyin::

ben bağımlılıkları eklemek

@Override 
protected void attachBaseContext(Context base) { 
    super.attachBaseContext(base); 
    MultiDex.install(this); 
}