gpt4 book ai didi

android - AppCompatDelegate 无法实例化自定义 View inflater android.support.v7.app.AppCompatViewInflater

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:24:25 26 4
gpt4 key购买 nike

当获取发布 apk 时,我在应用程序的所有 Activity 中收到此错误日志

04-03 17:10:54.105 26527-26527/? I/AppCompatDelegate: Failed to instantiate custom view inflater android.support.v7.app.AppCompatViewInflater. Falling back to default.
java.lang.ClassNotFoundException: android.support.v7.app.AppCompatViewInflater
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:309)
at java.lang.Class.forName(Class.java:273)
at android.support.v7.app.j.b(AppCompatDelegateImplV9.java:1014)
at android.support.v7.app.j.onCreateView(AppCompatDelegateImplV9.java:1092)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3605)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3677)
at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1943)
at android.support.v7.app.j.x(AppCompatDelegateImplV9.java:374)
at android.support.v7.app.j.w(AppCompatDelegateImplV9.java:323)
at android.support.v7.app.j.b(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.c.setContentView(AppCompatActivity.java:139)
at com.myapp.example.MainActivity.I(MainActivity.java:1523)
at com.myapp.example.MainActivity.onCreate(MainActivity.java:358)
at android.app.Activity.performCreate(Activity.java:6010)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413)
at android.app.ActivityThread.access$800(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
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:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.AppCompatViewInflater" on path: DexPathList[[zip file "/data/app/com.myapp.example-1/base.apk"],nativeLibraryDirectories=[/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 java.lang.Class.classForName(Native Method) 
at java.lang.Class.forName(Class.java:309) 
at java.lang.Class.forName(Class.java:273) 
at android.support.v7.app.j.b(AppCompatDelegateImplV9.java:1014) 
at android.support.v7.app.j.onCreateView(AppCompatDelegateImplV9.java:1092) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:482) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:3605) 
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3677) 
at com.android.internal.policy.impl.PhoneWindow.getDecorView(PhoneWindow.java:1943) 
at android.support.v7.app.j.x(AppCompatDelegateImplV9.java:374) 
at android.support.v7.app.j.w(AppCompatDelegateImplV9.java:323) 
at android.support.v7.app.j.b(AppCompatDelegateImplV9.java:284) 
at android.support.v7.app.c.setContentView(AppCompatActivity.java:139) 
at com.myapp.example.MainActivity.I(MainActivity.java:1523) 
at com.myapp.example.MainActivity.onCreate(MainActivity.java:358) 
at android.app.Activity.performCreate(Activity.java:6010) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413) 
at android.app.ActivityThread.access$800(ActivityThread.java:155) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5343) 
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:905) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700) 
Suppressed: java.lang.ClassNotFoundException: android.support.v7.app.AppCompatViewInflater
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)
... 32 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

App Gradle 配置如下:

  • compileSdkVersion 27,
  • buildToolsVersion "25.0.3"
  • minSdkVersion 16,
  • targetSdkVersion 24
  • support_library_version = '27.1.0',
  • google_play_services_version = '12.0.1'**

注意:我只在发布版本中遇到此错误,在调试版本中没有。

谢谢。

最佳答案

编写 Pro Guard 规则:

-dontwarn android.support.v7.**
-保持类android.support.v7.** { *; }
-保持接口(interface)android.support.v7.** { *; }

关于android - AppCompatDelegate 无法实例化自定义 View inflater android.support.v7.app.AppCompatViewInflater,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49629621/

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