์๋ ํ์ธ์. ์ฌ์ฉ์๋ก๋ถํฐ ์ค๋ฅ ๋ก๊ทธ๋ฅผ ๋ฐ์์ต๋๋ค.
java.lang.RuntimeException: Unable to create application my.CustomApplication: java.lang.NullPointerException
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4584)
at android.app.ActivityThread.access$1600(ActivityThread.java:161)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1325)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException
at android.os.Environment.getStorageState(Environment.java:715)
at android.os.Environment.getExternalStorageState(Environment.java:690)
at com.nostra13.universalimageloader.utils.getCacheDirectory(SourceFile:68)
at my.CustomApplication.onCreate(SourceFile:97)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1025)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4581)
... 10 more
์ฅ์น ์ฌ์ :
๋ชจ๋ธ SCH-I545
์๋๋ก์ด๋ 4.2.2
๋ง์ด ๋ผ์ธ โ97
File cacheDir = StorageUtils.getCacheDirectory(getApplicationContext());
์๋ ํ์ธ์. ์ด๋ค UIL ๋ฒ์ ?
์์ค๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค. cfd8fa982243์ ๋ํ ๋ด ํ์ ๋ชจ๋ Android-Universal-Image-Loader ๋งํฌ
์ฌ์ฉ์ (๊ธฐ๊ธฐ : Samsung GT-I9300, Android 4.3), UIL v 1.9.1์ ์ ์ฌํ ๋ณด๊ณ ์๊ฐ ์์ต๋๋ค.
์คํ ํธ๋ ์ด์ค์์ ๊ฐ์ฅ ํฅ๋ฏธ๋ก์ด ๋ถ๋ถ :
at android.os.Environment.getExternalStorageState(Environment.java:598)
at com.nostra13.universalimageloader.utils.StorageUtils.java.io.File getCacheDirectory(android.content.Context,boolean)(SourceFile:68)
at com.nostra13.universalimageloader.core.ImageLoaderConfiguration$Builder.com.nostra13.universalimageloader.core.ImageLoaderConfiguration build()(SourceFile:545)
GrepCode ์์ ์ณค์ต๋๋ค.
66-69 ํ์์ ์์ธ๊ฐ ๋ฐ์ํ๊ฑฐ๋ StorageManager # getPrimaryVolume () ์ด null์ ๋ฐํํ๋ ๊ฒฝ์ฐ NPE๋ฅผ ์์ฑ ํ ์์๋ ๊ฒ์ฒ๋ผ ๋ณด์
๋๋ค.
๋๋ฌ์ด ํด๊ฒฐ ๋ฐฉ๋ฒ์ NPE๋ฅผ ํฌ์ฐฉํ๊ณ ์ธ๋ถ ์ ์ฅ์๊ฐ ๋์ ธ ์ง ๊ฒฝ์ฐ ๋ง์ดํธ๋์ง ์๋๋ค๊ณ ๊ฐ์ ํ๋ ๊ฒ์
๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ฌ์ฉ์ (๊ธฐ๊ธฐ : Samsung GT-I9300, Android 4.3), UIL v 1.9.1์ ์ ์ฌํ ๋ณด๊ณ ์๊ฐ ์์ต๋๋ค.
์คํ ํธ๋ ์ด์ค์์ ๊ฐ์ฅ ํฅ๋ฏธ๋ก์ด ๋ถ๋ถ :
GrepCode ์์ ์ณค์ต๋๋ค.
66-69 ํ์์ ์์ธ๊ฐ ๋ฐ์ํ๊ฑฐ๋ StorageManager # getPrimaryVolume () ์ด null์ ๋ฐํํ๋ ๊ฒฝ์ฐ NPE๋ฅผ ์์ฑ ํ ์์๋ ๊ฒ์ฒ๋ผ ๋ณด์ ๋๋ค.
๋๋ฌ์ด ํด๊ฒฐ ๋ฐฉ๋ฒ์ NPE๋ฅผ ํฌ์ฐฉํ๊ณ ์ธ๋ถ ์ ์ฅ์๊ฐ ๋์ ธ ์ง ๊ฒฝ์ฐ ๋ง์ดํธ๋์ง ์๋๋ค๊ณ ๊ฐ์ ํ๋ ๊ฒ์ ๋๋ค.