读取 json 文件时出错。问题是什么?

Error reading json file. What is the problem?

在 Android Studio 中,我生成了一个 APK 文件以发布到 Google Play。但是当我从 APK 文件检查我的游戏如何运行时,当我转到菜单时,游戏崩溃了。读取 json 文件时出现错误。同时,当我通过 USB 从 Android Studio 将游戏安装到智能手机时,读取 json 文件没有错误 - 游戏运行正常。有什么问题?

com.badlogic.gdx.utils.j0: Error reading file: 123.json
    at a.a.a.z.a.k.k.b(Unknown Source:30)
    at a.a.a.z.a.k.k.<init>(Unknown Source:87)
    at com.aysenivanov24.blackjack.f.c.<init>(Unknown Source:83)
    at com.aysenivanov24.blackjack.f.a$a.b(Unknown Source:114)
    at a.a.a.u.a.x.b(Unknown Source:183)
    at a.a.a.u.a.l.onDrawFrame(Unknown Source:201)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1577)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1272)
Caused by: com.badlogic.gdx.utils.j0: Error reading file: 123.json
    at com.badlogic.gdx.utils.p.a(Unknown Source:35)
    at a.a.a.z.a.k.k.b(Unknown Source:6)
    ... 7 more
Caused by: com.badlogic.gdx.utils.j0: 
    at a.a.a.z.a.k.k$b.a(Unknown Source:31)
    at a.a.a.z.a.k.k$b.a(Unknown Source:0)
    at com.badlogic.gdx.utils.p.a(Unknown Source:124)
    at a.a.a.z.a.k.k$a.a(Unknown Source:27)
    at com.badlogic.gdx.utils.p.a(Unknown Source:10)
    ... 8 more
Caused by: com.badlogic.gdx.utils.w0.e: Class not found: com.badlogic.gdx.graphics.g2d.BitmapFont
    at com.badlogic.gdx.utils.w0.b.a(Unknown Source:25)
    at a.a.a.z.a.k.k$b.a(Unknown Source:18)
    ... 12 more
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.graphics.g2d.BitmapFont
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:454)
    at java.lang.Class.forName(Class.java:379)
    at com.badlogic.gdx.utils.w0.b.a(Unknown Source:0)
    ... 13 more
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.graphics.g2d.BitmapFont
    ... 17 more

我的json文件

{
    "com.badlogic.gdx.graphics.g2d.BitmapFont": {
        "font": {
            "file": "111.fnt"
        }
    },
    "com.badlogic.gdx.graphics.Color": {
        "RGBA_0_0_0_255": {
            "r": 0,
            "g": 0,
            "b": 0,
            "a": 1
        },
        "RGBA_255_255_255_255": {
            "a": 1,
            "b": 1,
            "g": 1,
            "r": 1
        }
    },
    "com.badlogic.gdx.scenes.scene2d.ui.Label$LabelStyle": {
        "default": {
            "font": "font"
        }
    },
    "com.badlogic.gdx.scenes.scene2d.ui.List$ListStyle": {
        "default": {
            "font": "font",
            "fontColorSelected": "RGBA_0_0_0_255",
            "fontColorUnselected": "RGBA_0_0_0_255",
            "selection": "select",
            "background": "back"
        }
    },
    "com.badlogic.gdx.scenes.scene2d.ui.ScrollPane$ScrollPaneStyle": {
        "default": {
            "hScrollKnob": "scroll",
            "vScrollKnob": "scroll"
        }
    },
    "com.badlogic.gdx.scenes.scene2d.ui.SelectBox$SelectBoxStyle": {
        "default": {
            "font": "font",
            "fontColor": "RGBA_255_255_255_255",
            "disabledFontColor": "RGBA_255_255_255_255",
            "background": "selectbox11",
            "scrollStyle": "default",
            "listStyle": "default",
            "backgroundDisabled": "selectbox22"
        }
    },
    "com.badlogic.gdx.scenes.scene2d.ui.TextTooltip$TextTooltipStyle": {
        "default": {
            "label": "default"
        }
    }
}

检查 build.gradle 中的 minifyEnabled(模块:...)。它应该是 false 或创建 proguard 规则

buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }