【问题标题】:Strange error when trying to read file from apk instead of androidstudio-emulator尝试从 apk 而不是 android studio-emulator 读取文件时出现奇怪的错误
【发布时间】:2020-08-05 10:56:40
【问题描述】:

我有一个从以下位置读取 JSON 的 Android /Kotlin 应用程序: https://www.androdocs.com/files/uploads/original/sample-json-data-1567767983.txt

当我使用完全相同的应用程序并阅读以下内容时: http://www.makumaku.de/test.txt

它适用于 Android Studio 模拟器。 但是如果我从我的手机测试 apk,我只能从第一个 txt 文件中读取。第二个 -txt 文件会导致白屏。

-> 为什么/我怎样才能使http://www.makumaku.de/test.txt -file 在移动设备上也可以读取?谢谢

【问题讨论】:

    标签: android json file android-studio cross-domain


    【解决方案1】:

    android:usesCleartextTraffic="true"

    是解决方案,如果有人也需要它

    【讨论】:

      猜你喜欢
      • 2020-10-19
      • 1970-01-01
      • 2023-03-07
      • 2018-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多