小编Tha*_*ang的帖子

如何卸载 Rosetta 的 Homebrew 并在 Mac Bigsu (M1) 上安装 Homebrew 本机

以前我在 MacOs M1 上安装了 Homebrew rosetta 版本,现在我看到 HomeBrew 有原生版本,那么我如何在 rosetta 上删除 HomeBrew 并安装原生版本。请帮我解决这个问题,谢谢

homebrew rosetta apple-m1

4
推荐指数
1
解决办法
1873
查看次数

错误:java.io.IOException:android 11 中没有这样的文件或目录

我试图在文件系统上创建一个文件,但仍然遇到此异常:

private fun getTempFolder(): File {
        val directoryFolder =
            File(Environment.getExternalStorageDirectory(), "sample-take-image")
        directoryFolder.mkdirs()
        return directoryFolder
    }
    private fun getTempFile(): File {
        val timeStamp = SimpleDateFormat("yyyyMMdd_HHMMss", Locale.getDefault()).format(Date())
        return File(
            getTempFolder().absolutePath,
            "image".plus(Calendar.getInstance().timeInMillis).plus(timeStamp).plus(".jpg")
        )
    }
    private fun saveImageToFile(bitmap: Bitmap? = null): String? {
        return try {
            val file = getTempFile()
            Timber.e("Path: + : ${file.absolutePath}")
            file.createNewFile()
            val fOut = FileOutputStream(file)
            bitmap?.apply {
                this.compress(Bitmap.CompressFormat.JPEG, 100, fOut)
            }
            fOut.flush()
            fOut.close()
            file?.absolutePath.getDefault()
        } catch (e: Exception) {
            e.printStackTrace()
            ""
        }
    }

Run Code Online (Sandbox Code Playgroud)

尽管我在拍照后得到了链接:

:/存储/模拟/0/sample-take-image/image162064003789420210510_160517.jpg

那么有人可以告诉我为什么在这种情况下我无法创建文件。我目前 使用的是Android 11

**编译SdkVersion …

java android file kotlin android-studio

3
推荐指数
1
解决办法
9073
查看次数

标签 统计

android ×1

android-studio ×1

apple-m1 ×1

file ×1

homebrew ×1

java ×1

kotlin ×1

rosetta ×1