Android/Exception
-
[Android] android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notificationAndroid/Exception 2020. 12. 14. 09:59
์๋๋ก์ด๋ ์๋ฌ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ๋ํ ๊ธ์ ๋๋ค. ๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๋ Notification ์ ์ฌ์ฉ ์์ Oreo ๋ฒ์ (API26) ์ด์์ด๋ฉด notification Channel์ ๋ฑ๋กํด์ผ ํฉ๋๋ค. ์ด notification Channel์ ๋ฑ๋กํ์ง ์์ ๊ฒฝ์ฐ์ ๋ฐ์ํ๋ ์ค๋ฅ๋ก ๋ค์ ์ฝ๋๋ฅผ ์ถ๊ฐํ๋ฉด ํด๊ฒฐ๋ฉ๋๋ค. public void createNotificationChannel() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { NotificationManager manager = getBaseContext().getSystemService(NotificationManager.class); NotificationChannel serviceChannel =..
-
[Android] java.lang.IllegalAccessException : is not accessible from java.lang.Class<android.app.Instrumentation>Android/Exception 2020. 10. 25. 18:47
์๋๋ก์ด๋ ์๋ฌ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ๋ํ ๊ธ์ ๋๋ค. java.lang.IllegalAccessException : is not accessible from java.lang.Class ์๋ฌ ํด๊ฒฐ ๋ฐฉ๋ฒ ์คํ๋์ ํ๋ฉด์ ๊ฐ๋ฐํ๋ ์ค์ ๋ฐ์ํ๋ ์๋ฌ์ ๋๋ค. ์คํ๋์ ํ๋ฉด์ ์ง์ ํ๋ ๋ฐฉ๋ฒ์๋ xml์ setContentView๋ฅผ ์์ฑํ๊ฑฐ๋, style๋ก theme๋ฅผ ์์ฑํ๋ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค. style์ theme๋ก ์์ฑํ๊ธฐ ์ํด์ ์๋ก์ด class๋ฅผ ๋ง๋ค ๋ public์ ์ง์ ํ์ง ์์ ๊ฒฝ์ฐ ๋ค์๊ณผ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํฉ๋๋ค. ๋ฐ๋ผ์, ์๋ก์ด class์ public์ผ๋ก ์์ฑํ๋ฉด ํด๊ฒฐํ ์ ์์ต๋๋ค.