Cleartext http traffic to server.com not permitted

后端 未结 5 1290
無奈伤痛
無奈伤痛 2020-12-16 05:28

My code is working on android KitKat but it when running it in Pie gives io exception

Cleartext http traffic to server.com not permitted

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-16 06:07

    First step is understanding why Google enforces you to use HTTPS. You can read more about it on the developers page.

    As for how to fix it, there are two options:

    1) Use HTTPS!

    2) Create a new file in your XML folder named security_config.xml and add this:

    
    
        
            
                
            
        
    
    

    then in your Manifest file add this

    
    
        
    
        
     
    

    For obvious reasons, the second point is not recommended!

提交回复
热议问题