0

Android 2.3.3을 사용하고 있습니다. 사용시 USB 장치 디렉토리가 생성됩니다. 그러나 에뮬레이터에서는 디렉토리가 생성되지 않습니다. 코드mkdirs가 android studio에서 작동하지 않습니다.

:

String SDK= Environment.getExternalStorageDirectory().getAbsolutePath(); 
String DB=SDK+"/MathEdu/DataBase"; 

File file=new File(DB); 

file.mkdirs(); 
if (file.exists()){ 
    Log.i("log", "exists"); 
} else{ 
    Log.i("log", "not exists"); 
} 

그리고 내 Android.Manifest.xml에서 나는

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 

을 그리고 로그 캣 : 에뮬레이터 장치에서

10-05 06:43:23.145 3001-3001/? I/art: Not late-enabling -Xcheck:jni (already on) 
10-05 06:43:23.145 3001-3001/? W/art: Unexpected CPU variant for X86 using defaults: x86 
10-05 06:43:23.197 3001-3001/ir_100110.mathedu W/System: ClassLoader 
referenced unknown path: /data/app/ir_100110.mathedu-1/lib/x86 

                [ 10-05 06:43:23.208 
1834: 2021 D/   ] 
                HostConnection::get() 
New Host Connection established 0x94a83fc0, tid 2021 
10-05 06:43:23.240 3001-3001/ir_100110.mathedu W/art: Before Android 4.1, 
method android.graphics.PorterDuffColorFilter 
android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 
10-05 06:43:24.191 3001-3016/ir_100110.mathedu I/OpenGLRenderer: Initialized EGL, version 1.4 
10-05 06:43:24.191 3001-3016/ir_100110.mathedu D/OpenGLRenderer: Swap behavior 1 
10-05 06:43:24.191 3001-3016/ir_100110.mathedu W/OpenGLRenderer: Failed to 
choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 
10-05 06:43:24.191 3001-3016/ir_100110.mathedu D/OpenGLRenderer: Swap behavior 0 
10-05 06:43:26.875 3001-3001/ir_100110.mathedu I/log: not exists 

답변

0

설정으로 이동 -> 앱 ->-> 허가 저장