发生运行时权限错误E / Minikin:addFont无法创建字体/system/fonts/NanumGothic.ttf

时间:2017-01-24 11:08:48

标签: android android-fragments

我在google和stackoverflow上搜索了很多,我收到了这个错误

  

E / Minikin:addFont无法在片段中创建字体/system/fonts/NanumGothic.ttf,之后重新加载片段

请帮我这个?我在重新加载允许按钮片段后获得运行时权限。

  if (PermissionChecker.checkSelfPermission(getActivity(),
                        android.Manifest.permission.CAMERA)
                        != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(getActivity(),
                        Manifest.permission.CAMERA)
                        != PackageManager.PERMISSION_GRANTED && PermissionChecker.checkSelfPermission(getActivity(),
                        Manifest.permission.READ_EXTERNAL_STORAGE)
                        != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(getActivity(),
                        Manifest.permission.READ_EXTERNAL_STORAGE)
                        != PackageManager.PERMISSION_GRANTED) {



                    requestPermissions(new String[]{Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE}, 1);

                    // ActivityCompat.requestPermissions(getActivity(),new String[]{android.Manifest.permission.CAMERA}, 0);
                } else {


                    //opening an intent


                }

这是我的logcat。

    Failed sending reply to debugger: Broken pipe
 Unsupported class: com.mediatek.common.telephony.IOnlyOwnerSimSupport
 addFont failed to create font /system/fonts/NanumGothic.ttf
 addFont failed to create font /system/fonts/DroidSansFallback.ttf
 addFont failed to create font /system/fonts/MTLmr3m.ttf
 getServiceInstance failed!
 ssl=0x7fb2458980 cert_verify_callback x509_store_ctx=0x7f8bd7e360 arg=0x0
ssl=0x7fb2458980 cert_verify_callback calling verifyCertificateChain authMethod=ECDHE_RSA

这是我的依赖

 compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.android.gms:play-services:9.4.0'

如果我创建其他项目,但为什么它不能在我身边工作呢?

4 个答案:

答案 0 :(得分:1)

 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
   verifyStoragePermissions(this);
 }
  public static void verifyStoragePermissions(Activity activity) {
// Check if we have read or write permission
      int writePermission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
int readPermission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE);

if (writePermission != PackageManager.PERMISSION_GRANTED || readPermission != PackageManager.PERMISSION_GRANTED) {
    // We don't have permission so prompt the user
    ActivityCompat.requestPermissions(
    activity, PERMISSIONS_STORAGE, REQUEST_EXTERNAL_STORAGE);
}

}

答案 1 :(得分:1)

您可能尝试使用旧操作系统版本中不存在的方法。 所以,试试这个:

@SuppressLint("NewApi")
    private void if60level() {
        // TODO Auto-generated method stub
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
//yourcode

        } else {
//nothing to do
        }
    }

private boolean canAll() {
        return (canAccessLocation() && canCoarseLocation() && canGetAccounts());
    }

答案 2 :(得分:1)

我得到了奇怪的解决方案

在您的构建中,gradle必须具有targetsdkversion。我正在删除开发目的。添加后,片段重新加载停止。

答案 3 :(得分:0)

在我的情况下,这是因为ttf资源坏了,所以我重新复制并修复了