반응형

안드로이드 스튜디오 업데이트 후 기존 앱의 빌드 버전을 업하면서 아래와 같은 에러가 발생하였습니다.

 

zoom SDK를 업데이트하면서 기존의 gradle을 업데이트 중이었습니다.

classpath 'com.android.tools.build:gradle:4.1.2'  -> 7.1.2로 변경

 

에러 메시지

 

관련 에러 확인 방법

  1. 안드로이드 스튜디오에서 AndroidManifest.xml를 연다.
  2. 열린 파일 아래쪽에 Merged Manifest 탭을 누른다.
  3. 관련 에러를 확인한다.

해결

에러 내용

Error: Attribute application@allowBackup value=(true) from AndroidManifest.xml:53:9-35 is also present at AndroidManifest.xml:84:9-36 value=(false). Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:52:5-142:19 to override. test.app main manifest (this file), line 52

해결

android:allowBackup="true" -> false로 변경

 

에러 내용

Error: Attribute application@usesCleartextTraffic value=(true) from AndroidManifest.xml:59:9-44 is also present at AndroidManifest.xml:87:9-45 value=(false). Suggestion: add 'tools:replace="android:usesCleartextTraffic"' to element at AndroidManifest.xml:52:5-142:19 to override. test.app main manifest (this file), line 58

해결

 tools:replace="android:usesCleartextTraffic"추가 

android:usesCleartextTraffic="true"
tools:replace="android:usesCleartextTraffic">

 

728x90
반응형
반응형

Switch / ToggleButton / CheckBox

스위치(Switch)는 두 가지 옵션(상태)을 표시하는 버튼이다.

이와 유사한 UI에는 토글 버튼, 체크 박스가 쓰일 수 있다.

 

Switch 주요 속성

  • android : showText - on/off (설정/해제) Text가 보일지 안보일지를 결정하는 속성.
  • android : thumbTextPadding - Switch Caption과 Thumb 사이의 간격
  • android : switchMinWidth - 스위치의 너비 최소 크기
  • android : switchPadding - Switch Caption과 스위치 사이의 간격
  • androiid : switchAppearance - on/off Text의 Style 지정
  • android : textOff - off 상태일 때 표시될 Text 지정
  • android : textOn - On 상태일 때 표시될 Text 지정
  • android : textStyle - Text Style(bold, italic, bolditalic)
  • android : thumb - 사용자 드래그를 통해 on/off 설정이 가능하도록 하는 thumb 모양
  • android : thumbTint - thumb에 색상 지정
  • android : track - track 모양 지정
  • android : trackTint - track에 색상 지정

 

Customizing

switch

그림과 같은 Switch버튼으로 customizing을 해보겠습니다.

 

android : track -  drawable 파일 생성

switch_track_on.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">

    <solid android:color="#0b27ff" />	 <!-- 테두리 내부 색상 설정 -->

    <!-- 테두리 내부 여백 설정 -->
    <padding
            android:bottom="5dp"
            android:left="2dp"
            android:right="2dp"
            android:top="5dp" />

    <!-- 테두리 설정: 두께, 색상 -->
    <stroke
            android:width="1dp"
            android:color="#000" />
    <corners android:radius="20dp"/>
</shape>

switch_track_off.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">

    <solid android:color="#c7c8d9" />	<!-- 테두리 내부 색상 설정 -->

    <!-- 테두리 내부 여백 설정 -->
    <padding
        android:bottom="5dp"
        android:left="2dp"
        android:right="2dp"
        android:top="5dp" />

    <!-- 테두리 설정: 두께, 색상 -->
    <stroke
            android:width="1dp"
            android:color="#0b27ff" />
    <corners android:radius="20dp"/>
</shape>

selector_switch.xml

android:state_checked의 상태에 따라서 true 즉 on일 때는 @drawable/switch_track_on을 설정

android:state_checked의 상태에 따라서 false 즉 off일 때는 @drawable/switch_track_off를 설정 

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:drawable="@drawable/switch_track_on" />
    <item android:state_checked="false" android:drawable="@drawable/switch_track_off" />
</selector>

 

android : thumb -  drawable 파일 생성

switch_thumb.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="#ffffff" />
    <stroke
        android:width="5dp"
        android:color="#ffffff"/>
    <size android:width="22dp"
        android:height="22dp"/>
</shape>

 

사용할 xml 파일에 적용

<Switch
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:switchPadding="8dp"
    android:thumb="@@drawable/switch_thumb"
    android:track="@drawable/selector_switch"
    android:switchMinWidth="50dp"
/>

 

728x90
반응형
반응형

개발자가 아니어도 안드로이드폰을 쓰다 보면 adb android를 통해 폰을 제어할 일이 생긴다.

adb android 파일을 설치 해보도록 하자.

 

 

adb android 설치 순서

  1. SDK 플랫폼 도구 - 다운로드 사이트로 이동
  2. 내가 쓰는 플랫폼 선택
    1. Windows용 SDK 플랫폼 도구 다운로드
    2. Mac용 SDK 플랫폼 도구 다운로드
    3. Linux용 SDK 플랫폼 도구 다운로드
  3. 사용 약관 동의
  4. adb파일 다운로드(아래의 링크 참조)
  5. 압축 파일을 해제한다.
  6. cmd창(터미널)에서 해당 경로로 이동해서 adb를 쳐보면 실행이 되는지 확인한다.

 

adb android 실행 결과 화면

adb

 

adb android 다운로드 파일

https://developer.android.com/studio/releases/platform-tools

 

SDK 플랫폼 도구 출시 노트  |  Android 개발자  |  Android Developers

Android SDK 플랫폼 도구는 Android SDK의 구성요소입니다.

developer.android.com

 

에러 조치 

  1. USB 연결 상태에서 adb devices 결과가 'unauthorized' 에러가 발생하는 경우
    1. adb가 정상적으로 설치한 상태에서 $ adb devices에서 unauthorized 가 표시되는 경우 스마트 폰에서 "USB 디버깅 허용"을 선택합니다.

  2. USB 연결 상태에서 adb devices 결과에 스마트 폰 검색이 되지 않는 경우
    1. 핸드폰 제조사 USB 드라이드가 설치되지 않아서 발생하는 것
    2. 각 제조사에 맞는 USB 통합 드라이버를 설치하면 해결

728x90
반응형
반응형

최근 잘 쓰고 있던 안드로이드 스튜디오를 업데이트 하고 아래와 같은 메시지가 발생했다. 

Android Gradle plugin requires java 11 to run. you are currently using java 1.8

 

1) 방법

  1. Preference를 누른다.
  2. Build, Execution, Deployment - Gradle로 진입한다.
  3. Gradle projects - Gradle JDK를 찾는다.
  4. 콤보박스에서 JDK 11를 찾아 누른다.

또는

  1. 메뉴 File -> Project Structure 를 누른다.
  2. SDK Location에서 JDK location was moved to Gradle Settings에 Gradle Settings을 누른다.
  3. Gradle JDK를 눌러서 JDK 11을 누른다.

 

2. 에러 메시지

> Failed to apply plugin 'com.android.internal.application'.
    > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
       You can try some of the following options:
          - changing the IDE settings.
          - changing the JAVA_HOME environment variable.
          - changing `org.gradle.java.home` in `gradle.properties`.

 

 

728x90
반응형
반응형

android를 빌드하다 보면 아래와 같은 에러가 발생할 때가 있습니다. 

 

1. 에러 메시지 : 

05/16 09:59:04: Launching 'app' on rockchip rk3399-all.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_SHARED_USER_INCOMPATIBLE

List of apks:
[0] '..app/build/outputs/apk/debug/app-arm64-v8a-debug.apk'
Installation failed due to: 'null'

 

 

2. 원인은 간단한데, AndroidManifest.xml안의 sharedUserId 때문이다. 

    애플리케이션이 sharedUserId를 설정된 상태에서 다른 사인 키를 사용했을 때 발생한다. 

 

 

3. 참고 ) 안드로이드 공식 문서 내용

 

https://developer.android.com/guide/topics/manifest/manifest-element.html

 

Android 개발자  |  Android Developers

"AndroidManifest.xml

developer.android.com

728x90
반응형
반응형

안드로이드 스튜디오를 사용하다보면 플로그인, 설정, 메모리, 캐쉬 등이 꼬여서 느려지거나 사용할 수 없게 될때가 많다.

아래의 방법을 사용하면 안드로이드 스튜디오를 다시 설치하지 않고도 초기화할수 있다.

 

On Windows:

Go to your User Folder - on Windows 7/8 this would be:

[SYSDRIVE]:\Users\[your username] (ex. C:\Users\MyName\)

In this folder there should be a folder called .
AndroidStudioBeta or .AndroidStudio (notice the period at the start - so on some OSes it would be hidden).
Delete this folder (or better yet, move it to a backup location - so you can return it if something goes wrong).
This should reset your Android Studio settings to default.

 

For MaxOSX:

rm -rfv ~/Library/Application\ Support/AndroidStudio*
rm -rfv ~/Library/Preferences/AndroidStudio*
rm -rfv ~/Library/Caches/AndroidStudio*
rm -rfv ~/Library/Logs/AndroidStudio*
rm -rfv ~/.AndroidStudio*

 

728x90
반응형

+ Recent posts