我制作了一个带有网络视图的简单应用,并将其发布到Playstore-一切正常。最近,我更新了webview的ip,更改了版本代码,生成了签名的apk并重新上传到playstore。但是,当我下载它进行测试时,它崩溃了。

    08-21 03:48:34.916 926-4059/? I/ActivityManager: START u0
    {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
    flg=0x10000000 pkg=com.rayzor536.appointments
    cmp=com.rayzor536.appointments/.MainActivity} from uid 10039
    08-21 03:48:34.995 926-4061/? I/ActivityManager: Start proc 703
    4:com.rayzor536.appointments/u0a137 for activity
    com.rayzor536.appointments/.MainActivity
    08-21 03:48:35.149 7034-7034/? I/zygote: Rejecting re-init on previously-failed class java.lang.Class<com.rayzor536.appointments.MainActivity>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;
08-21 03:48:35.149 7034-7034/? I/zygote: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatActivity" on path: DexPathList[[zip file "/data/app/com.rayzor536.appointments-ijS7lUJ8dmD9B9er-lMpYw==/base.apk"],nativeLibraryDirectories=[/data/app/com.rayzor536.appointments-ijS7lUJ8dmD9B9er-lMpYw==/lib/arm, /system/lib, /system/vendor/lib]]
08-21 03:48:35.152 7034-7034/? E/AndroidRuntime: FATAL EXCEPTION: main
                                                 Process: com.rayzor536.appointments, PID: 7034
                                                 java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.rayzor536.appointments/com.rayzor536.appointments.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.rayzor536.appointments.MainActivity" on path: DexPathList[[zip file "/data/app/com.rayzor536.appointments-ijS7lUJ8dmD9B9er-lMpYw==/base.apk"],nativeLibraryDirectories=[/data/app/com.rayzor536.appointments-ijS7lUJ8dmD9B9er-lMpYw==/lib/arm, /system/lib, /system/vendor/lib]]
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2680)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2857)
                                                     at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1590)
                                                     at android.os.Handler.dispatchMessage(Handler.java:106)
                                                     at android.os.Looper.loop(Looper.java:164)
                                                     at android.app.ActivityThread.main(ActivityThread.java:6499)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
                                                  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.rayzor536.appointments.MainActivity" on path: DexPathList[[zip file "/data/app/com.rayzor536.appointments-ijS7lUJ8dmD9B9er-lMpYw==/base.apk"],nativeLibraryDirectories=[/data/app/com.rayzor536.appointments-ijS7lUJ8dmD9B9er-lMpYw==/lib/arm, /system/lib, /system/vendor/lib]]
                                                     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                     at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2670)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2857) 
                                                     at android.app.ActivityThread.-wrap11(Unknown Source:0) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1590) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                     at android.os.Looper.loop(Looper.java:164) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:6499) 
                                                     at java.lang.reflect.Method.invoke(Native Method) 
                                                     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
                                                    Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/AppCompatActivity;
                                                     at java.lang.VMClassLoader.findLoadedClass(Native Method)
                                                     at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
                                                            ... 12 more
                                                  Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatActivity" on path: DexPathList[[zip file "/data/app/com.rayzor536.appointments-ijS7lUJ8dmD9B9er-lMpYw==/base.apk"],nativeLibraryDirectories=[/data/app/com.rayzor536.appointments-ijS7lUJ8dmD9B9er-lMpYw==/lib/arm, /system/lib, /system/vendor/lib]]
                                                     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
                                                     at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                                                            ... 15 more
08-21 03:48:35.157 926-5481/? W/ActivityManager:   Force finishing activity com.rayzor536.appointments/.MainActivity
08-21 03:48:35.173 926-1066/? I/ActivityManager: Showing crash dialog for package com.rayzor536.appointments u0
08-21 03:48:35.662 926-1065/? W/ActivityManager: Activity pause timeout for ActivityRecord{6e9e3f1 u0 com.rayzor536.appointments/.MainActivity t1469 f}
08-21 03:48:35.895 926-1416/? I/WindowManager: Failed to capture screenshot of Token{26fabd6 ActivityRecord{6e9e3f1 u0 com.rayzor536.appointments/.MainActivity t1469 f}} appWin=Window{313f14f u0 Splash Screen com.rayzor536.appointments EXITING} drawState=4
08-21 03:48:42.402 926-5481/? W/ActivityManager:   Force finishing activity com.rayzor536.appointments/.MainActivity
08-21 03:48:42.404 926-5481/? I/ActivityManager: Killing 7034:com.rayzor536.appointments/u0a137 (adj 900): crash


我的gradle文件如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.rayzor536.appointments"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 3
        versionName "1.0.2"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            postprocessing {
                removeUnusedCode false
                removeUnusedResources false
                obfuscate false
                optimizeCode false
                proguardFile 'proguard-rules.pro'
            }
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    compile 'com.android.support:multidex:1.0.3'
}


这是我的应用清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.rayzor536.appointments">

    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:name="android.support.multidex.MultiDexApplication">
        <activity android:name="com.rayzor536.appointments.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

最佳答案

错误行
找不到类“ com.rayzor536.appointments.MainActivity”
说您在某个地方弄乱了android manifest.xml文件
更改版本代码后,请一次检查清单文件是否良好。

07-26 08:22