gpt4 book ai didi

java - Android ClassNotFoundException 在路径 : DexPathList 上找不到类

转载 作者:行者123 更新时间:2023-11-29 02:36:27 24 4
gpt4 key购买 nike

直到昨天我的应用程序运行良好,今天突然开始崩溃并出现 Retrofit2 错误所以我通过升级依赖项并将 multidex 添加到我的应用程序来解决它,问题是现在当我尝试启动应用程序时它没有找到任何 Activity 类,就像它不存在一样,我在这里查看了每个类似的问题,但没有答案解决了我的问题,我现在不知道如何解决它,有什么想法吗?我使用自定义应用程序类:

主要应用程序(Kotlin):

class MainApplication : Application() {

override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)
MultiDex.install(this)
}

override fun onCreate() {
super.onCreate()
MainApplication.appContext = applicationContext
}

companion object {
var appContext: Context? = null
private set
}

}

安卓 list

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

<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="false" />

<!--<permission-->
<!--android:name="com.project.purifficapp.permission.MAPS_RECEIVE"-->
<!--android:protectionLevel="signature" />-->
<!-- Allows to receive map -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.project.purifficapp.permission.MAPS_RECEIVE" />
<!-- Used by the Google Maps Android API V2 to download map tiles from Google Maps servers -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

<!-- android:roundIcon="@mipmap/ic_circle" -->

<application
android:name="com.aarr.vip365.MainApplication"
android:hardwareAccelerated="true"
android:allowBackup="true"
android:icon="@mipmap/ic_quarevip"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppThemeNoActionBar"
android:largeHeap="true"
tools:node="replace">
<uses-library android:name="com.google.android.maps"/>
<activity android:name="com.aarr.vip365.Views.MainActivity" />
<activity
android:name="com.aarr.vip365.Views.LoginActivity"
android:label="@string/title_activity_login"
android:screenOrientation="portrait" />
<activity android:name="com.aarr.vip365.Views.RegistroActivity" />
<activity
android:name="com.aarr.vip365.Views.MenuActivity"
android:label="@string/title_activity_menu"
android:screenOrientation="portrait"
android:theme="@style/AppThemeNoActionBar" >
</activity>

<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />

<activity
android:name="com.aarr.vip365.Views.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.aarr.vip365.Views.PagosActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.aarr.vip365.Views.BuscarRutaActivity"
android:screenOrientation="portrait" />

<service
android:name="com.paypal.android.sdk.payments.PayPalService"
android:exported="false" />

<activity android:name="com.paypal.android.sdk.payments.PaymentActivity" />
<activity android:name="com.paypal.android.sdk.payments.LoginActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentMethodActivity" />
<activity android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity" />
<activity android:name="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity" />
<activity android:name="com.paypal.android.sdk.payments.FuturePaymentConsentActivity" />
<activity android:name="com.paypal.android.sdk.payments.FuturePaymentInfoActivity" />
<activity android:name="io.card.payment.DataEntryActivity" />
<activity android:name="com.aarr.vip365.Views.ConfiguracionActivity"
android:screenOrientation="portrait" />
<activity android:name="com.aarr.vip365.Views.EditUserActivity"
android:screenOrientation="portrait" ></activity>
</application>

</manifest>

构建. Gradle :

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.aarr.vip365"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
// multiDexKeepFile file 'multidex_config.txt'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
android.defaultConfig.manifestPlaceholders = [
facebookAppId : "516038112090677",
googleWebClientId : "215137711124-8bir20vatiima1fll9ehba0jv7ch9itb.apps.googleusercontent.com",
twitterConsumerKey : "your twitter consumer key",
twitterConsumerSecret: "your twitter consumer secret",
instagramClientId : "your instagram client id",
instagramClientSecret: "your instagram client secret",
instagramRedirectUri : "your instagram redirect uri"
]
}

dependencies {
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'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile('com.paypal.sdk:paypal-android-sdk:2.15.3') {
exclude group: 'io.card'
}
compile 'com.google.android.gms:play-services-auth:11.0.4'
compile 'com.google.android.gms:play-services-auth:11.0.4'

compile 'com.android.support:support-core-utils:25.4.0'
compile 'com.android.support:animated-vector-drawable:25.4.0'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:support-compat:25.4.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'

compile 'com.github.siyamed:android-shape-imageview:0.9.3'
compile 'com.j256.ormlite:ormlite-android:5.0'
compile 'com.j256.ormlite:ormlite-core:5.0'

compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.squareup.okio:okio:1.6.0'

compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-ads:11.0.4'
compile 'com.google.android.gms:play-services-gcm:11.0.4'
compile 'com.google.maps.android:android-maps-utils:0.4'

compile 'com.github.championswimmer:Android-SocialButtons:1.0'
compile 'com.mindorks:paracamera:0.2.2'
compile 'com.github.bumptech.glide:glide:4.2.0'
compile 'com.squareup.picasso:picasso:2.5.2'

compile 'com.github.KingsMentor:Luhn:v2.1.3'
compile 'com.github.jaychang0917:SimpleAuth:1.0.4'

compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'

testCompile 'junit:junit:4.12'
annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0'
}
repositories {
mavenCentral()
}

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

错误:

10-12 13:18:37.014 15090-15090/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.aarr.vip365, PID: 15090
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.aarr.vip365/com.aarr.vip365.Views.SplashActivity}: java.lang.ClassNotFoundException: Didn't find class "com.aarr.vip365.Views.SplashActivity" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.aarr.vip365-1/base.apk"],nativeLibraryDirectories=[/data/app/com.aarr.vip365-1/lib/arm, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2555)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5951)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.aarr.vip365.Views.SplashActivity" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.aarr.vip365-1/base.apk"],nativeLibraryDirectories=[/data/app/com.aarr.vip365-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2545)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767) 
at android.app.ActivityThread.access$900(ActivityThread.java:177) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:145) 
at android.app.ActivityThread.main(ActivityThread.java:5951) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195) 
Suppressed: java.lang.NoClassDefFoundError: com.aarr.vip365.Views.SplashActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.aarr.vip365.Views.SplashActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)... 13 more

Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

最佳答案

在 Android Studio 上禁用 Instant Run 对我有用。 (设置 - 构建、执行、部署 > 即时运行)

关于java - Android ClassNotFoundException 在路径 : DexPathList 上找不到类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46716573/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com