android– 在路径上找不到类:DexPathList?

android– 在路径上找不到类:DexPathList?,第1张

概述当我在Androidstudio中使用USB在真实设备中测试时,我的应用程序工作正常.但是当我将apk发送到另一台设备并安装在那里时,它无法正常工作.App得到崩溃.我没有找到任何正确的方法来解决问题.错误如下:FATALEXCEPTION:mainProcess:com.w3xplorers.cmch,PID:17715

当我在Android studio中使用USB在真实设备中测试时,我的应用程序工作正常.但是当我将apk发送到另一台设备并安装在那里时,它无法正常工作.App得到崩溃.我没有找到任何正确的方法来解决问题.错误如下:

FATAL EXCEPTION: main Process: com.w3xplorers.cmch,PID: 17715                                                                           java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.w3xplorers.cmch/com.w3xplorers.cmch.MainActivity}: java.lang.classNotFoundException: DIDn't find class "com.w3xplorers.cmch.MainActivity" on path: DexPathList[[zip file "/data/app/com.w3xplorers.cmch-1/base.apk"],nativelibraryDirectorIEs=[/data/app/com.w3xplorers.cmch-1/lib/arm, /system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]]    at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2395)    at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)    at androID.app.ActivityThread.access0(ActivityThread.java:150)    at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)    at androID.os.Handler.dispatchMessage(Handler.java:102)    at androID.os.Looper.loop(Looper.java:168)    at androID.app.ActivityThread.main(ActivityThread.java:5845)    at java.lang.reflect.Method.invoke(Native Method)    at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:797)    at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:687)    Caused by: java.lang.classNotFoundException: DIDn't find class "com.w3xplorers.cmch.MainActivity" on path: DexPathList[[zip file "/data/app/com.w3xplorers.cmch-1/base.apk"],nativelibraryDirectorIEs=[/data/app/com.w3xplorers.cmch-1/lib/arm, /system/lib, /vendor/lib, system/vendor/lib, system/vendor/lib/egl, system/lib/hw]]    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:1085)    at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2385)    at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)     at androID.app.ActivityThread.access0(ActivityThread.java:150)     at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)     at androID.os.Handler.dispatchMessage(Handler.java:102)     at androID.os.Looper.loop(Looper.java:168)     at androID.app.ActivityThread.main(ActivityThread.java:5845)     at java.lang.reflect.Method.invoke(Native Method)     atcom.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)     at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:687)                                                                         Suppressed: java.lang.classNotFoundException: com.w3xplorers.cmch.MainActivity    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)                                                                                ... 12 more    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

我的清单如下:

`<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"package="com.w3xplorers.cmch"><uses-permission androID:name="androID.permission.INTERNET" /><uses-permission androID:name="androID.permission.READ_PHONE_STATE" /><uses-permission androID:name="androID.permission.READ_CONTACTS" /><uses-permission androID:name="androID.permission.WRITE_CONTACTS" /><uses-permission androID:name="androID.permission.SEND_SMS" /><application    androID:name="com.w3xplorers.cmch.EnableMultIDex"    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" >    <activity        androID:name="com.w3xplorers.cmch.MainActivity"        androID:screenorIEntation="portrait"        androID:theme="@style/Apptheme.NoActionbar" >        <intent-filter>            <action androID:name="androID.intent.action.MAIN" />            <category androID:name="androID.intent.category.LAUNCHER" />        </intent-filter>    </activity>    <activity        androID:name="com.w3xplorers.cmch.HomeActivity"        androID:screenorIEntation="portrait"        androID:theme="@style/Apptheme.NoActionbar" />    <activity        androID:name="com.w3xplorers.cmch.QuickSms"        androID:screenorIEntation="portrait"        androID:theme="@style/Apptheme.NoActionbar" />    <activity        androID:name="com.w3xplorers.cmch.GroupSms"        androID:screenorIEntation="portrait"        androID:theme="@style/Apptheme.NoActionbar" />    <activity        androID:name="com.w3xplorers.cmch.SelfSms"        androID:screenorIEntation="portrait"        androID:theme="@style/Apptheme.NoActionbar" />    <activity        androID:name="com.w3xplorers.cmch.Contact"        androID:screenorIEntation="portrait"        androID:theme="@style/Apptheme.NoActionbar" />    <activity        androID:name="com.w3xplorers.cmch.Favourite"        androID:screenorIEntation="portrait"        androID:theme="@style/Apptheme.NoActionbar" />    <activity        androID:name="com.w3xplorers.cmch.Info"        androID:screenorIEntation="portrait"        androID:theme="@style/Apptheme.NoActionbar" />    <activity androID:name="com.w3xplorers.cmch.Dialog" /></application></manifest>`

Gradle如下:

apply plugin: 'com.androID.application'androID {compileSdkVersion 25buildToolsversion "25.0.2"defaultConfig {    applicationID "com.w3xplorers.cmch"    minSdkVersion 13    targetSdkVersion 25    versionCode 1    versionname "1.0"    testInstrumentationRunner "androID.support.test.runner.AndroIDJUnitRunner"    multIDexEnabled true}buildTypes {    release {        MinifyEnabled false        proguardfiles getDefaultProguardfile('proguard-androID.txt'), 'proguard-rules.pro'    }}}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 'com.androID.support:appcompat-v7:25.3.0'compile 'com.androID.support.constraint:constraint-layout:1.0.0-Alpha5'compile 'com.androID.support:design:25.3.0'compile 'com.andreabaccega:androID-form-edittext:1.0.3'compile 'com.androID.volley:volley:1.0.0'compile 'com.squareup.okhttp3:okhttp:3.3.1'compile 'com.androID.support:multIDex:1.0.1'testCompile 'junit:junit:4.12'}

解决方法:

转到项目级build.gradle文件,并将gradle依赖的版本减少到低于2.3.0的任何值,比如使用2.2.3

dependencIEs {    classpath 'com.androID.tools.build:gradle:2.2.3'    ....}

然后清理 – > build – >将deBUG apk安装到其他设备 – >它可能就行了!

总结

以上是内存溢出为你收集整理的android – 在路径找不到类:DexPathList?全部内容,希望文章能够帮你解决android – 在路径上找不到类:DexPathList?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1099964.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存