Why can't I import android.os.StrictMode?
-
25-06-2021 - |
Domanda
Why I am facing error at the import android.os.StrictMode?
import android.os.StrictMode;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
--->StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
I have tried to implement a strictmode.java class. strictmode.java taken from here. However, I am facing the imports errors of this.
import android.app.ActivityManagerNative;
import android.app.ApplicationErrorReport;
import com.android.internal.os.RuntimeInit;
import dalvik.system.BlockGuard;
What should I do? Or is there another way to implement in this? I have to implement this in order to run my application on Android 3.0.
Soluzione
StrictMode
is available since API level 9.
So make sure your build target is at least API level 9 (Android 2.3.1).
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow