Java Android 10上的通货膨胀/书法崩溃

Java Android 10上的通货膨胀/书法崩溃,java,android,android-studio,android-10.0,calligraphy,Java,Android,Android Studio,Android 10.0,Calligraphy,我将我的targetSdkVersion从26增加到29,并面临这次崩溃: ReflectionUtils.java io.github.inflationx.viewpump.ReflectionUtils.getValue 关于我的应用程序: -java语言中的应用程序 -不使用android X -targetSdkVersion29 渐变中的当前相关性: implementation 'io.github.inflationx:calligraphy3:3.0.0' implement

我将我的targetSdkVersion26增加到29,并面临这次崩溃:

ReflectionUtils.java io.github.inflationx.viewpump.ReflectionUtils.getValue

关于我的应用程序:

-java语言中的应用程序

-不使用android X

-targetSdkVersion29

渐变中的当前相关性

implementation 'io.github.inflationx:calligraphy3:3.0.0'
implementation 'io.github.inflationx:viewpump:1.0.0'
我还查看了以下所有链接,但都没有帮助:

我还升级了我的依赖项,如下所示:

但是我得到了以下错误:

java.lang.NoClassDefFoundError:未能解析:Landroidx/core/os/BuildCompat;
在io.github.inflationx.viewpump.internal.-viewPumpPlayOutFlater.(-viewPumpPlayOutFlater.kt:25)
在io.github.inflationx.viewpump.ViewPumpContextWrapper$inflater$2.invoke(ViewPumpContextWrapper.kt:25)
在io.github.inflationx.viewpump.ViewPumpContextWrapper$inflater$2.invoke(ViewPumpContextWrapper.kt:22)
在kotlin.UnsafeLazyImpl.getValue处(Lazy.kt:81)
位于io.github.inflationx.viewpump.ViewPumpContextWrapper.getInflater(未知来源:7)
位于io.github.inflationx.viewpump.ViewPumpContextWrapper.getSystemService(ViewPumpContextWrapper.kt:31)
位于android.view.LayoutInflater.from(LayoutInflater.java:229)
位于android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:167)
位于android.app.Activity.getSystemService(Activity.java:6146)
位于android.view.LayoutInflater.from(LayoutInflater.java:229)
在com.android.internal.policy.PhoneWindow上(PhoneWindow.java:346)
在com.android.internal.policy.PhoneWindow上(PhoneWindow.java:362)
位于android.app.Activity.attach(Activity.java:7246)
在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3055)上
位于android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
在android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
在android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)中
在android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)中
在android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)上
位于android.os.Handler.dispatchMessage(Handler.java:106)
位于android.os.Looper.loop(Looper.java:214)
位于android.app.ActivityThread.main(ActivityThread.java:7050)
位于java.lang.reflect.Method.invoke(本机方法)
位于com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
位于com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
原因:java.lang.ClassNotFoundException:在路径:DexPathList[[zip文件”/data/app/ir.daal.app.debug-h0TdlfmBM6nnB6Tuy6emlg==/base.apk”]的NativeLibrary目录中未找到类“androidx.core.os.BuildCompat”=[/data/app/ir.daal.app.debug-h0TdlfmBM6nnB6Tuy6emlg==/lib/arm64,/data/app/ir.daal.app.debug-h0TdlfmBM6nnB6Tuy6emlg==/base.apk!/lib/arm64-v8a,/system/lib64,/system/vendor/lib64]]
位于dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
位于java.lang.ClassLoader.loadClass(ClassLoader.java:379)
位于java.lang.ClassLoader.loadClass(ClassLoader.java:312)
在io.github.inflationx.viewpump.internal.-viewPumpPlayOutFlater.(-viewPumpPlayOutFlater.kt:25)
在io.github.inflationx.viewpump.ViewPumpContextWrapper$inflater$2.invoke(ViewPumpContextWrapper.kt:25)
在io.github.inflationx.viewpump.ViewPumpContextWrapper$inflater$2.invoke(ViewPumpContextWrapper.kt:22)
在kotlin.UnsafeLazyImpl.getValue处(Lazy.kt:81)
位于io.github.inflationx.viewpump.ViewPumpContextWrapper.getInflater(未知来源:7)
位于io.github.inflationx.viewpump.ViewPumpContextWrapper.getSystemService(ViewPumpContextWrapper.kt:31)
位于android.view.LayoutInflater.from(LayoutInflater.java:229)
位于android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:167)
位于android.app.Activity.getSystemService(Activity.java:6146)
位于android.view.LayoutInflater.from(LayoutInflater.java:229)
在com.android.internal.policy.PhoneWindow上(PhoneWindow.java:346)
在com.android.internal.policy.PhoneWindow上(PhoneWindow.java:362)
位于android.app.Activity.attach(Activity.java:7246)
在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3055)上
位于android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
在android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
在android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)中
在android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)中
在android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)上
位于android.os.Handler.dispatchMessage(Handler.java:106)
位于android.os.Looper.loop(Looper.java:214)
位于android.app.ActivityThread.main(ActivityThread.java:7050)
位于java.lang.reflect.Method.invoke(本机方法)
位于com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
位于com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
我没有在Android X上找到任何关于此版本书法使用限制的文档

有没有更好的方法来解决这次崩溃,而不是将targetSdkVersion降低到28


这可能不适合您,但我放弃了书法要求:

我意识到我无论如何都需要将我的应用程序更新到androidx。因此,一旦我迁移到androidx,这个问题就得到了解决:


嘿,您可以直接使用
android:fontfamine=“@font/aktiv_bold”
按钮、文本视图、编辑文本的属性…来设置自定义字体,n
implementation 'io.github.inflationx:calligraphy3:3.1.1'
implementation 'io.github.inflationx:viewpump:2.0.3'
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/core/os/BuildCompat;
    at io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.<init>(-ViewPumpLayoutInflater.kt:25)
    at io.github.inflationx.viewpump.ViewPumpContextWrapper$inflater$2.invoke(ViewPumpContextWrapper.kt:25)
    at io.github.inflationx.viewpump.ViewPumpContextWrapper$inflater$2.invoke(ViewPumpContextWrapper.kt:22)
    at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81)
    at io.github.inflationx.viewpump.ViewPumpContextWrapper.getInflater(Unknown Source:7)
    at io.github.inflationx.viewpump.ViewPumpContextWrapper.getSystemService(ViewPumpContextWrapper.kt:31)
    at android.view.LayoutInflater.from(LayoutInflater.java:229)
    at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:167)
    at android.app.Activity.getSystemService(Activity.java:6146)
    at android.view.LayoutInflater.from(LayoutInflater.java:229)
    at com.android.internal.policy.PhoneWindow.<init>(PhoneWindow.java:346)
    at com.android.internal.policy.PhoneWindow.<init>(PhoneWindow.java:362)
    at android.app.Activity.attach(Activity.java:7246)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3055)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7050)
    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:965)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.core.os.BuildCompat" on path: DexPathList[[zip file "/data/app/ir.daal.app.debug-h0TdlfmBM6nnB6Tuy6emlg==/base.apk"],nativeLibraryDirectories=[/data/app/ir.daal.app.debug-h0TdlfmBM6nnB6Tuy6emlg==/lib/arm64, /data/app/ir.daal.app.debug-h0TdlfmBM6nnB6Tuy6emlg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/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 io.github.inflationx.viewpump.internal.-ViewPumpLayoutInflater.<init>(-ViewPumpLayoutInflater.kt:25) 
    at io.github.inflationx.viewpump.ViewPumpContextWrapper$inflater$2.invoke(ViewPumpContextWrapper.kt:25) 
    at io.github.inflationx.viewpump.ViewPumpContextWrapper$inflater$2.invoke(ViewPumpContextWrapper.kt:22) 
    at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:81) 
    at io.github.inflationx.viewpump.ViewPumpContextWrapper.getInflater(Unknown Source:7) 
    at io.github.inflationx.viewpump.ViewPumpContextWrapper.getSystemService(ViewPumpContextWrapper.kt:31) 
    at android.view.LayoutInflater.from(LayoutInflater.java:229) 
    at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:167) 
    at android.app.Activity.getSystemService(Activity.java:6146) 
    at android.view.LayoutInflater.from(LayoutInflater.java:229) 
    at com.android.internal.policy.PhoneWindow.<init>(PhoneWindow.java:346) 
    at com.android.internal.policy.PhoneWindow.<init>(PhoneWindow.java:362) 
    at android.app.Activity.attach(Activity.java:7246) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3055) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257) 
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) 
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948) 
    at android.os.Handler.dispatchMessage(Handler.java:106) 
    at android.os.Looper.loop(Looper.java:214) 
    at android.app.ActivityThread.main(ActivityThread.java:7050) 
    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:965) 
            <Button
                ...
                android:fontFamily="@font/aktiv_bold"
                ...
                >
            </Button>
@Override
    protected void attachBaseContext(Context newBase) {

        //Implement this for api 28 and below
        if(Build.VERSION.SDK_INT < Build.VERSION_CODES.Q){
            super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
        }
        //Or implement this for api 29 and above
        else {
            super.attachBaseContext(newBase);
        }
    }