1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

No <domain> elements in <domain-config> [NetworkSecurityConfig]エラーが発生した時の話

Posted at

Android StudioでBuild Variantreleaseに切り替えて、エミュレーターで試しに実行してみようとしたところ次のようなエラーが発生しました。

Error: No <domain> elements in <domain-config> [NetworkSecurityConfig]
    <domain-config cleartextTrafficPermitted="false">
     ~~~~~~~~~~~~~

   Explanation for issues of type "NetworkSecurityConfig":
   Ensures that a <network-security-config> file, which is pointed to by an
   android:networkSecurityConfig attribute in the manifest file, is valid

src/debug/xml/network_security_config.xmlを次のように用意していました。

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">10.0.2.2</domain>
    </domain-config>
</network-security-config>

ところが、src/release/xml/network_security_config.xmlは作成していたものの、<domain /><domain-config />に追加していませんでした。

なので、同じように<domain includeSubdomains="true">10.0.2.2</domain>を追加したところ上記のエラーは消えました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?