简体   繁体   English

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

[英]Android Studio - app crashes on startup, I have no idea what this error means: Caused by: java.lang.ClassNotFoundException: [...]

I am trying to customize an open-source eCommerce app that I have found on github.我正在尝试自定义我在 github 上找到的开源电子商务应用程序。 When I have downloaded it it was compiling and working, but when I updated dependencies and changed firebase to mine the problem unfolded.当我下载它时,它正在编译和工作,但是当我更新依赖项并更改 firebase 以挖掘问题时,问题就展开了。 When I try to run the app on phone I get this error message:当我尝试在手机上运行该应用程序时,我收到此错误消息:

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

Here is my build.grade file:这是我的 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'

There is a lot of random code because I tried everything I found online before I came here.有很多随机代码,因为我在来这里之前尝试了我在网上找到的所有内容。

I hope that you can help me.我希望你能帮助我。

//EDIT //编辑

Here is the original gradle file:这是原始的gradle文件:

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'

This is a proguard issue that will need to be fixed when building a release apk build.这是一个 proguard 问题,在构建发布 apk 版本时需要修复。

Here is a better solution for you for development:这是一个更好的开发解决方案:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter App 在启动时和通过 java.lang.ClassNotFoundException 在生产中崩溃 - Flutter App crashes on production on startup and through java.lang.ClassNotFoundException 错误:android studio 中的 java.lang.ClassNotFoundException - Error : java.lang.ClassNotFoundException in android studio Android Studio错误:原因:java.lang.ClassNotFoundException:未找到类 - Android Studio error: Caused by: java.lang.ClassNotFoundException: Didn't find class 错误“由以下引起:java.lang.ClassNotFoundException:” - Error “Caused by: java.lang.ClassNotFoundException:” Eclipse启动错误java.lang.ClassNotFoundException - Eclipse startup error java.lang.ClassNotFoundException 我有一个无法跟踪的java.lang.ClassNotFoundException错误 - I have an java.lang.ClassNotFoundException error that I cannot trace 得到java.lang.RuntimeException ...由GooglePlay安装后首次启动app后引发:java.lang.ClassNotFoundException - Got java.lang.RuntimeException … Caused by: java.lang.ClassNotFoundException after first startup of app after install from GooglePlay 我有这个错误&#39;java.lang.ClassNotFoundException&#39;-Spring - I have this error 'java.lang.ClassNotFoundException' - Spring Spring Web App-由Java.lang.ClassNotFoundException引起的CannotLoadBeanClassException - Spring Web App - CannotLoadBeanClassException caused by Java.lang.ClassNotFoundException Android 2.1:引起:java.lang.ClassNotFoundException:Fragment - Android 2.1 :Caused by: java.lang.ClassNotFoundException: Fragment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM