更新gradle文件的依存关系后,我的应用程序出现错误。 当我尝试设置我的“编辑文本”
android:inputType="number"
并尝试输入一些数字,我的应用程序崩溃了。
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.insharp.payle, PID: 7694
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/view/KeyEventCompat;
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:532)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:315)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:342)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5037)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4905)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4479)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4445)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4585)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4453)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4642)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4479)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4445)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4453)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7092)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7061)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7022)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4203)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6680)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.view.KeyEventCompat" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/base.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_dependencies_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_resources_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_0_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_1_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_2_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_3_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_4_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_5_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_6_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_7_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_8_apk.apk", zip file "/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:532)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:57)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:315)
at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:342)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:5037)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4905)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4479)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4445)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4585)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4453)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4642)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4479)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4445)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4453)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4426)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7092)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7061)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7022)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4203)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6680)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
E/AndroidRuntime: Suppressed: java.io.IOException: No original dex files found for dex location /data/app/com.insharp.payle-hVY9vArgPO9gcFTOxf2IeQ==/split_lib_resources_apk.apk
at dalvik.system.DexFile.openDexFileNative(Native Method)
at dalvik.system.DexFile.openDexFile(DexFile.java:354)
at dalvik.system.DexFile.<init>(DexFile.java:101)
at dalvik.system.DexFile.<init>(DexFile.java:75)
at dalvik.system.DexPathList.loadDexFile(DexPathList.java:394)
at dalvik.system.DexPathList.makeDexElements(DexPathList.java:354)
at dalvik.system.DexPathList.<init>(DexPathList.java:164)
at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:74)
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:74)
at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:40)
at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:727)
at android.app.LoadedApk.getClassLoader(LoadedApk.java:810)
at android.app.LoadedApk.getResources(LoadedApk.java:1032)
at android.app.ContextImpl.createAppContext(ContextImpl.java:2345)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5760)
at android.app.ActivityThread.access$1100(ActivityThread.java:200)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1651)
... 6 more
E/ACRA: ACRA caught a NoClassDefFoundError exception for com.insharp.payle. Building report.
这是例外。
我认为该错误是由于KeyEventCompat导致的,该事件现在已弃用。但是我找不到合适的解决方案。 任何帮助将不胜感激
这是我的编辑文字
<EditText
android:id="@+id/etProductQty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/register_edittext_background"
android:inputType="number"
android:hint="@string/text_product_qty"
android:textColorHint="@color/grey_border_2"
/>
我的build.gradle文件
// compile 'com.isseiaoki:simplecropview:1.1.4'
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.wrapp.floatlabelededittext:library:0.0.6'
compile 'com.android.support:support-v4:27.0.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
// compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:play-services-gcm:16.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'uk.me.lewisdeane.ldialogs:ldialogs:1.2.0@aar'
compile 'com.google.firebase:firebase-core:16.0.3'
compile 'com.google.firebase:firebase-messaging:17.3.1'
答案 0 :(得分:0)
清理构建的缓存并重新构建项目,有时在库上进行一些重大更改时,这会发生在我身上。
如果这不能帮助尝试使缓存无效并重新启动,也许共享更多代码可以帮助发现问题,有了这些信息,这些是我唯一想到的事情。
答案 1 :(得分:0)
我相信您已经声明了应用兼容兼容性。
com.android.support:appcompat-v7:X.X.X