본문 바로가기

나의 플랫폼/안드로이드

[Android] build gradle failed to resolve ## 현재 오류 발생 및 해결은 Android Studio 3.2 버전에서 발생함. 갑자기 어느 순간에 ' failed to resolve' 라는 에러와 함께 특정 라이브러리가 로딩이 되지 않는다는 Gradle 에러를 볼 수 있다.이럴 경우 혹시 아래와 같이 build.gradle 파일이 되어 있지 않은가 확인 해보세요.또는 jcenter()가 포함되어 있는지 체크해보세요. # build.gradlebuildscript { ... repositories { google() jcenter() ... } ... } allprojects { repositories { google() jcenter() ... } } jcenter() 에서 특정 라이브러리를 받아오지 못하는 에러가 발생한게 원인이었습니다. htt.. 더보기
[Kotlin] View Height, Width 변경 Kotlin의 Extension 기능을 이용하면 쉽게 View에 크기를 조절할 수 있다. /** * Extension method to set View's height. */ fun View.setHeight(value: Int) { val lp = layoutParams lp?.let { lp.height = value layoutParams = lp } }/** * Extension method to set View's width. */ fun View.setWidth(value: Int) { val lp = layoutParams lp?.let { lp.width = value layoutParams = lp } }http://kotlinextensions.com/#view 위 두 함수를 추가 해놓.. 더보기
[Android] Unit Test, Android UI Test 폴더 관리 기본적으로 android studio 에서 앱을 생성하기 되면 아래와 같은 폴더 형태가 됩니다.androidTest 폴더에서는 Android 디바이스에서 UI릍 테스트 하지요. 그리고 test 폴더에서는 간단한 JUnit Test를 하는데요.위 상태라면 문제 없이 테스트가 잘 동작 합니다. 그럼... 혹시 아래 같은 상황을 보신적은 없으신가요?웁쓰... 위 정상적인 폴더 형태와 달라진 점 찾으셨나요??java 폴더가 녹색이 아닌 파란색으로 되어 있네요.그리고 테스트 소스에 들어가니 온통 빨간색 에러들 뿐입니다.갑자기 잘되던 놈이 테스트와 관련된 annotation이나 class를 하나 같이 못 찾고 있네요.(참고로 전 이걸 해결 하는데 반나절 걸린듯 하네요;;;) 원인은 test 폴더를 지정을 별도로 지.. 더보기
[Android] Could not find com.android.tools.lint:lint-gradle 혹시 Release로 빌드시 아래와 같은 에러가 보인다면.Could not find com.android.tools.lint:lint-gradle 그럼 build.gradle에 아래 부분이 추가 되어 있는지 확인 해보세요.allprojects { repositories { google() jcenter() } } 저 오류는 google() repositories가 빠질 경우 발생 한다고 하네요.https://stackoverflow.com/a/47127602 참고 하세요. 더보기
[Android] adb shell 에서 문자 보내기 아래는 기본 명령어 형태 이다.adb shell am start -a android.intent.action.SENDTO -d sms:+1-222-333-444 --es sms_body 'text' --ez exit_on_sent true" 위 내용만 보면 'SENDTO' action을 보내는 데, 번호와 텍스트 데이터를 보내고, 메세지 기본앱이 종료 되었을 때메세지가 보내지는 명령어 이다. ##한 사람이 아니라 여러명에게 보낼 경우adb shell am start -a android.intent.action.SENDTO -d sms:+1-222-333-444,+1-555-666-7777 --es sms_body "내용" --ez exit_on_sent true ## 문자 내용에 개행 문자를 넣고 싶을 .. 더보기
[Android][lombok]Annotation processors must be explicitly declared now Android Studio 3.0 이상을 사용하다가 아래와 같은 에러가 발생할 경우가 있다.Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration. - lombok-1.12.4.jar (org.projectlombok:lombok:1.12.4)Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.. 더보기
[Android] Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Android Studio 3.0을 사용하다가 아래와 같은 에러가 나왔다. Information:Gradle: Executing tasks: [:app:assembleDebug, :app:assembleDebugUnitTest]Information:Gradle: BUILD FAILED in 4sInformation:Kotlin: Kotlin JPS plugin is disabledInformation:2018-04-19 오후 4:07 - Compilation completed with 5 errors and 0 warnings in 8s 510msError:Gradle: failed to create directory 'android-testing-master\unit\BasicSample-kotlinA.. 더보기
[Android] Deprecated 'TYPE_SYSTEM_ALERT ' Android O버전 부터 TYPE_SYSTEM_ALERT 이 Deprecated 된다는 경고를 볼 수 있다.그럴 경우 아래 소스를 참고 하기 바란다.private fun initWindowParams() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { mParams = WindowManager.LayoutParams( WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, PixelFormat.T.. 더보기