안드로이드 You need to use a Theme.AppCompat theme (or descendant) with this activity 오류해결 java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 다음과 같은 오류가 발생할땐 아래와 같이 해결한다 (Kotlin 기준) import 변경 import android.app.AlertDialog 아마 다음과 같이 잘못 되어있었을 것이다 import android.support.v7.app.AlertDialog 그럼에도 안된다면 다음과 같이 AlertDialog를 사용할 수 있도록 변경해보자 AlertDialog.Builder(this@MainActivity) Programming/Android 2022. 10. 31. A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction 오류 해결 원인 및 분석 META-INF 파일에 따른 빌드오류가 발생하는 경우가 있다 아래와 같은 오류가 생겼으며, 해결방법은 알아냈지만 아직 원인이 무엇인지는 모르겠다 2 files found with path 'META-INF/AL2.0'. Adding a packagingOptions block may help, please refer to https://developer.android.com/reference/tools/gradle-api/7.2/com/android/build/api/dsl/ResourcesPackagingOptions for more information FAILURE: Build failed with an exception. * What went wrong: Execution faile.. Programming/Android 2022. 10. 25. 안드로이드 진동 울리기 (VIBRATE) 안드로이드에서 진동을 울리기 위해서는 VIBRATE 권한이 필요하다 AndroidManifest.xml에 다음 퍼미션을 추가해주자 다음으로, 진동을 울리게 하고 싶은 메소드에서 getSystemService를 이용해서 Vibrator를 불러와 사용한다. Java Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(1000); // 1초간 진동 Kotlin val vibrator: Vibrator = getSystemService(VIBRATOR_SERVICE) as Vibrator vibrator.vibrate(VibrationEffect.createOneShot(1000, 100)) Programming/Android 2022. 10. 24. 이전 1 다음