gpt4 book ai didi

android - 找不到 dex 位置的原始 dex 文件

转载 作者:行者123 更新时间:2023-11-29 14:34:42 28 4
gpt4 key购买 nike

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.nnroh.debtmanager, PID: 23433
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.nnroh.debtmanager/com.example.nnroh.debtmanager.AddPersonActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class layout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class layout
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class layout
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.layout" on path: DexPathList[[zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/base.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_resources_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/lib/x86, /system/lib, /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.view.LayoutInflater.createView(LayoutInflater.java:606)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:703)
at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:68)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:720)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:788)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
at com.example.nnroh.debtmanager.AddPersonActivity.onCreate(AddPersonActivity.java:39)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.example.nnroh.debtmanager-eZJs9JyPFQcK5hHTFcCewQ==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:353)
at dalvik.system.DexFile.<init>(DexFile.java:100)
at dalvik.system.DexFile.<init>(DexFile.java:74)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
at dalvik.system.DexPathList.<init>(DexPathList.java:157)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:73)
at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:88)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:35)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:693)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:727)
at android.app.LoadedApk.getResources(LoadedApk.java:954)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2270)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5639)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
... 6 more

最佳答案

下面我列出了可能的解决方案,一个一个地尝试这个步骤:

  • 1 删除设备上的应用并清理项目

  • 2 在 Debug模式下禁用minifyEnabled

转到调试 block 中的 build.gradle(Module: app) 并禁用 minifyEnabled:

buildTypes {

debug {
minifyEnabled false

}
}

  • 3 在应用程序的 gradle 文件中将 dataBinding 设置为 true

在我的例子中,我包括了另一个布局 <include layout="@layout/attached_layout" />到我的 Activity 布局,这解决了它。

    android {
...
...
...

dataBinding {
enabled = true
}

}

  • 4 检查你的activity在manifest中的相对路径

例如:

<activity android:name="com.pathToClass.MyActivity"

  • 5 检查自定义 View 中的包名称

     <com.pathToClass.MyCustomView
    android:id="@+id/myview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="16dp"
    android:layout_marginRight="16dp" />

  • 6 尝试在应用程序 build.gradle 中禁用预索引:

     dexOptions {
    preDexLibraries false
    }

  • 7 禁用即时运行转到文件 -> 设置 -> 构建、执行部署 -> 即时运行 -> 取消选中 即时运行的复选框

  • 8 试用 MultiDexApplication

将此添加到 build.gradle(Module:app)

android { 

defaultConfig {
...
multiDexEnabled true
}

dependencies {
...
implementation 'androidx.multidex:multidex:2.0.1'
}


}

如果您正在使用应用程序类,您必须使用 MultiDexApplication 扩展它而不是 Application并将其添加到 AndroidManifest.xml

<application
android:name="com.myPackageName.MyApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">

其他 添加MultiDexApplication来自库的类路径作为名称

<application
android:name="androidx.multidex.MultiDexApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">

  • 9 Proguard 混淆

Looks like the class is loaded by reflection, but your proguard file doesn't prevent that class from being obfuscated

引用:http://www.tousu.in/qa/?qa=1116606/android-no-original-dex-files-found-for-dex-location

关于android - 找不到 dex 位置的原始 dex 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52269042/

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