首页 > 代码库 > 错误:StrictMode $ AndroidBlockGuardPolicy.onNetwork

错误:StrictMode $ AndroidBlockGuardPolicy.onNetwork

 

you have to insert 2 lines "StrictMode" on MainActivity Class, example‘s below:

 

在onCreate()方法下一行添加StrictMode

例子:
public class MainActivity extends Activity {
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //come here
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
 
    }
}

错误:StrictMode $ AndroidBlockGuardPolicy.onNetwork