Android Studio-应用程序在启动时崩溃,我不知道这个错误是什么意思:由java.lang.ClassNotF



我正在尝试自定义我在github上找到的开源电子商务应用程序。当我下载它时,它正在编译和工作,但当我更新依赖项并更改firebase以挖掘时,问题就出现了。当我尝试在手机上运行该应用程序时,我会收到以下错误消息:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/internal/zzpm$zza;
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at c.a.f.f(SourceFile:187)
at c.a.f.e(SourceFile:152)
at c.a.f.<init>(SourceFile:63)
at c.a.b.j(SourceFile:66)
at c.a.a.c(SourceFile:44)
at c.a.a.b(SourceFile:34)
at c.a.a.a(SourceFile:30)
at com.funmix.madeinpoland.init.CustomApplication.onCreate(SourceFile:37)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1155)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6003)
at android.app.ActivityThread.access$1200(ActivityThread.java:201)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1679)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6864)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.internal.zzpm$zza" on path: DexPathList[[zip file "/data/app/com.funmix.madeinpoland-akcb_ReD6ix8lWLFFYCluw==/base.apk"],nativeLibraryDirectories=[/data/app/com.funmix.madeinpoland-akcb_ReD6ix8lWLFFYCluw==/lib/arm64, /system/lib64, /system/product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:171)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 20 more

这是我的build.grade文件:

apply plugin: 'com.android.application'
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
compileSdkVersion 29
buildToolsVersion '29.0.2'
defaultConfig {
applicationId "com.funmix.madeinpoland"
minSdkVersion 21
targetSdkVersion 29
multiDexEnabled true
versionCode 1
versionName "1.1"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
useLibrary 'org.apache.http.legacy'
manifestPlaceholders = [onesignal_app_id               : "5c3d7b9b-1874-463f-8081-1c3439ccb3ea",
onesignal_google_project_number: "REMOTE"]
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled true
//useProguard false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
release {
minifyEnabled false
shrinkResources false
//useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation 'com.onesignal:OneSignal:3.15.4@aar'
//database operation lib
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
//google play services

implementation 'com.google.android.gms:play-services-base:17.5.0'
implementation 'com.google.android.gms:play-services-safetynet:17.0.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'

implementation 'com.google.android.gms:play-services-location:17.1.0'
//implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.2.1'


// Import the Firebase BoM
//implementation platform('com.google.firebase:firebase-bom:26.1.0')
// When using the BoM, you don't specify versions in Firebase library dependencies
// Declare the dependency for the Firebase SDK for Google Analytics
//implementation 'com.google.firebase:firebase-analytics'
// Declare the dependencies for any other desired Firebase products
// For example, declare the dependencies for Firebase Authentication and Cloud Firestore
//implementation 'com.google.firebase:firebase-auth'
//implementation 'com.google.firebase:firebase-firestore'
//implementation 'com.google.firebase:firebase-database'
//implementation 'com.firebaseui:firebase-ui:0.4.4'


implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation 'com.google.firebase:firebase-database:19.5.1'
implementation 'com.google.firebase:firebase-auth:20.0.1'
implementation 'com.firebaseui:firebase-ui:0.4.4'
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.daimajia.easing:library:2.4@aar'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.github.GrenderG:Toasty:1.2.5'
implementation 'com.daimajia.androidanimations:library:2.4@aar'
implementation 'com.mikepenz:aboutlibraries:6.0.8'
implementation 'com.mikepenz:materialdrawer:6.0.8'
//noinspection GradleDependency
implementation 'com.squareup.picasso:picasso:2.3.2'

implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation 'com.android.support:multidex:1.0.3'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.webianks.library:easy-feedback:1.0.2'
implementation 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
implementation('com.mikepenz:crossfadedrawerlayout:1.0.1@aar')
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.kaopiz:kprogresshud:1.1.0'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
//noinspection GradleDependency
implementation 'com.github.bumptech.glide:glide:3.8.0'
//noinspection GradleDependency
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'

implementation 'com.github.yesidlazaro:GmailBackground:1.2.0'
//Field and method binding for Android views which uses annotation processing
implementation 'com.jakewharton:butterknife:10.2.3'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'

implementation 'com.airbnb.android:lottie:3.5.0'

//Libraries I've included

//Stylish edittextbox
implementation 'com.github.florent37:materialtextfield:1.0.7'
//radiogroup
implementation 'com.github.Gavras:MultiLineRadioGroup:v1.0.0.6'
//ticker textview
implementation 'com.tomer:fadingtextview:2.5'
// Dexter runtime permissions
implementation 'com.karumi:dexter:6.2.2'
testImplementation 'junit:junit:4.13.1'
}
apply plugin: 'com.google.gms.google-services'

这里有很多随机代码,因为在我来这里之前,我尝试了在网上找到的所有东西。

我希望你能帮助我。

//编辑

这是原始渐变文件:

apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "com.beingdev.magicprint"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
manifestPlaceholders = [onesignal_app_id               : "5c3d7b9b-1874-463f-8081-1c3439ccb3ea",
onesignal_google_project_number: "REMOTE"]
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled true
useProguard true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
release {
minifyEnabled false
shrinkResources false
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'com.onesignal:OneSignal:3.+@aar'
//database operation lib
implementation 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
//google play services
implementation 'com.google.android.gms:play-services-gcm:11.0.1'
implementation 'com.google.android.gms:play-services-analytics:11.0.1'
implementation 'com.google.android.gms:play-services-location:11.0.1'
implementation 'com.google.android.gms:play-services:11.0.1'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:design:27.0.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.+'
implementation 'com.android.support:customtabs:27.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.daimajia.easing:library:2.0@aar'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.github.GrenderG:Toasty:1.2.5'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation('com.mikepenz:aboutlibraries:6.0.1@aar') {
transitive = true
}
implementation("com.mikepenz:materialdrawer:6.0.2@aar") {
transitive = true
}
implementation 'com.squareup.picasso:picasso:2.3.2'
implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation "com.android.support:recyclerview-v7:27.+"
implementation 'com.android.support:cardview-v7:27.+'
implementation "com.android.support:support-annotations:27.+"
implementation 'com.webianks.library:easy-feedback:1.0.2'
implementation 'com.geniusforapp.fancydialog:FancyDialog:0.1.4'
implementation('com.mikepenz:crossfadedrawerlayout:1.0.1@aar')
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.volley:volley:1.0.0'
implementation 'com.kaopiz:kprogresshud:1.1.0'
implementation 'com.getkeepsafe.taptargetview:taptargetview:1.11.0'
implementation 'com.github.bumptech.glide:glide:3.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
implementation 'com.github.yesidlazaro:GmailBackground:1.2.0'
//Field and method binding for Android views which uses annotation processing
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

implementation 'com.airbnb.android:lottie:2.2.5'
implementation 'com.firebaseui:firebase-ui:0.4.4'
//Libraries I've included
implementation 'com.google.firebase:firebase-database:9.4.0'
//Stylish edittextbox
implementation 'com.github.florent37:materialtextfield:1.0.7'
//radiogroup
implementation 'com.github.Gavras:MultiLineRadioGroup:v1.0.0.6'
//ticker textview
implementation 'com.tomer:fadingtextview:2.5'
// Dexter runtime permissions
implementation 'com.karumi:dexter:4.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

这是一个proguard问题,在构建发布版apk构建时需要修复。

这里有一个更好的开发解决方案:

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