728x90

파이썬 워드클라우드를 구축하기 위해 삽질을 하여, 이전 포스팅에서 최종 설치 방법을 정리하였음.

https://antimidal.tistory.com/51

 

[Python] Python WordCloud (한글) 파이썬 한글 워드클라우드 클린 설치

리눅스 CentOS 7.x 환경에서 Python 3.11 를 설치하고, 한글 워드 클라우드 (Word Cloud) 를 사용하는 방법을 정리함.1) Python 3.11 버전을 설치2) 한글 워드 클라우드 관련 패키지 설치 및 실행단, 설치하는

antimidal.tistory.com

운이 좋게 한번에 성공하면 다행이지만, 서버 상태에 따라 필수 패키지가 설치되어 있지 않다거나 리포지토리에 설치할 패키지가 없다거나, 패키지 끼리 호환이 안된다거나 하는 문제는 언제든 발생할 수 있음.
모든 오류의 상황들을 기록할 순 없지만 정리할 수 있는 선에서 정리를 함.

 

$ python3 --version
-------------------------------------------------------------------------
에러 내용: python3: error while loading shared libraries: libpython3.11.so.1.0: cannot open shared object file: No such file or directory
-------------------------------------------------------------------------
$ ls -l /usr/local/bin/python3
- /usr/local/bin/python3.11이 링크되어 있는지 확인
$ pip3 --version
-------------------------------------------------------------------------
경고 : WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
-------------------------------------------------------------------------
- pip 명령을 root 권한으로 실행할 때 발생되고, 가상환경을 사용할 것을 권장함.

$ python3 -m venv 가상환경설정이름
$ pip3 install konlpy
-------------------------------------------------------------------------
에러 내용: error: subprocess-exited-with-error ... error: metadata-generation-failed ...
-------------------------------------------------------------------------
- pip으로 파이썬 패키지를 설치할 때 자주 발생하는 오류

1) pip, setuptools, wheel 최신 버전으로 업그레이드
   $ pip3 install --upgrade pip setuptools wheel

2) 패키지 의존성 문제일 수 있으므로 필요한 개발 라이브러리 추가 설치
   $ yum install freetype-devel libpng-devel -y
   $ yum install java-1.8.0-openjdk-devel -y
   $ yum install gcc-c++ -y
   
3) 캐시 삭제 후 재시도
   $ pip3 cache purge
   $ pip3 install konlpy
   
4) JPype1 관련 문제일 수도 있으므로 JAVA_HOME 확인후 재설치
   $ echo 'export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk' >> ~/.bashrc
   $ echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc
   $ source ~/.bashrc
   
   # JPype1 다른 버전으로 설치해보는 것도 필요
   $ pip3 install JPype1 (최신 버전) 
   $ pip install --no-binary :all: --no-cache-dir JPype1==1.5.0 (1.5 버전)
   
   # JPype1 버전 확인
   $ python -c "import jpype; print(jpype.__version__)"
   # JVM 정상작동 확인
   $ python -c "import jpype; jpype.startJVM()"
$ pip3 install matplotlib
-------------------------------------------------------------------------
에러 내용: ERROR: Problem encountered: NumPy requires GCC >= 9.3
-------------------------------------------------------------------------
- GCC(GNU Compiler Collection) 버전이 너무 낮아서 numpy 2.3.1을 컴파일할 수 없다는 의미

1. GCC 업그레이드를 위해서 SCL 리포지토리 활성화 (EPEL 설치)
   $ yum clean all
   $ yum makecache
   $ yum install epel-release -y
   $ yum install centos-release-scl -y

2. GCC 9 설치
   $ yum install devtoolset-9 -y 
   - 최소 9이고 상위버전 가능
   - 패키지 검색되지 않으면, 레포지토리 변경 (Vault 리포지토리 사용 (CentOS 7 EOL 문제 해결))

3. 설치된 GCC 9 환경 활성화
   $ source /opt/rh/devtoolset-9/enable
   - 현재 셸 세션에만 적용되므로, 가상환경 시작(activate) 파일에 등록하여 사용

 4. 적용된 GCC 버전 확인
   $ gcc --version
   - 결과: Output should show GCC 9.x.x
$ yum install devtoolset-9 -y 
-------------------------------------------------------------------------
에러 내용: Error: Package: policycoreutils-python-2.5-29.el7.x86_64 또는 Error: Package: audit-libs-python-2.8.4-4.el7.x86_64
-------------------------------------------------------------------------
- devtoolset 패키지 의존 패키지 업그레이드 (또는 다운드레이드)

1. 업그레이드
   $ yum update policycoreutils policycoreutils-python update audit-libs audit-libs-python -y

2. 다운드레이드 (선택사항)
   - 현재 설치된 policycoreutils, audit-libs에 관련된(의존하는) 패키지 확인
   $ yum deplist policycoreutils-2.5-34.el7
   $ yum deplist audit-libs-2.8.5-4.el7
   - 문제가 없으면 다운그레이드
   $ yum downgrade policycoreutils policycoreutils-python -y
   $ yum downgrade audit-libs audit-libs-python -y

3. devtoolset-9 설치 재시도
   $ yum clean all
   $ yum makecache
   $ yum install devtoolset-9 -y
$ pip3 install konlpy
-------------------------------------------------------------------------
에러내용: RuntimeError: Can't find org.jpype.jar support library
-------------------------------------------------------------------------
- 관련 패키지 전체 삭제 후 다시 설치

1. 기존 설치된 JPype1과 konlpy 제거
   $ pip3 uninstall konlpy -y
   $ pip3 uninstall JPype1 -y
2. pip 캐시 정리
   $ pip3 cache purge
3. JPype1 먼저 설치 (Konlpy가 의존하므로)
   $ pip3 install --no-cache-dir JPype1
4. konlpy 설치
   $ pip3 install konlpy

 

 

반응형
728x90

리눅스 CentOS 7.x 환경에서 Python 3.11 를 설치하고, 한글 워드 클라우드 (Word Cloud) 를 사용하는 방법을 정리함.
1) Python 3.11 버전을 설치
2) 한글 워드 클라우드 관련 패키지 설치 및 실행

단, 설치하는 리눅스 패키지 버전과 파이썬 버전 패키지 버전, JDK 버전에 따라 예상치 못한 버그는 항상 존재함.
반복된 버그가 발생된다면 버전을 바꿔서 설치하면서 해결법을 찾을 것을 권장함.

## Python 3.11 설치

1. 개발 도구 설치
$ yum groupinstall "Development Tools" -y
$ yum install openssl-devel bzip2-devel libffi-devel zlib-devel wget -y

2. Python 3.11 소스 코드 다운로드 및 압축 해제
$ cd /usr/src
$ wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz
$ tar -xf Python-3.11.0.tgz

3. Python 3.11 컴파일 및 설치
$ cd Python-3.11.0
$ ./configure --enable-optimizations --enable-shared --with-openssl=/usr/bin/openssl 
$ make altinstall

4. Python 3.11 경로 설정
$ ln -s /usr/local/bin/python3.11 /usr/local/bin/python3
$ ln -s /usr/local/bin/pip3.11 /usr/local/bin/pip3
$ python3 --version
$ pip3 --version

5. Python 가상환경 사용 (wordcloud_env으로 가상환경 설정)
$ python3 -m venv wordcloud_env
- wordcloud_env 디렉토리 생성되고 해당 디렉토리에 가상환경 상에서 설치된 패키지들 저장됨
$ source wordcloud_env/bin/activate
- 가상환경 활성화 되면 프롬프트 앞에 (wordcloud_env)가 나타남
$ (wordcloud_env) deactivate
- 가상환경 비활성화 되고 (wordcloud_env) 사라짐

## 한글 Word Cloud 설치 및 실행

1. java, JDK 관련 확인 및 설치
$ java -version
$ javac -version
$ echo $JAVA_HOME

 (1) JAVA_HOME 이 확인되지 않을시 설치
 $ yum install java-1.8.0-openjdk-devel -y

$ echo 'export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk' >> ~/.bashrc
$ echo 'export PATH=$JAVA_HOME/bin:$PATH' >> ~/.bashrc
$ source ~/.bashrc
- .bashrc 파일에 등록하여 패스 설정


2. GCC 9 설치 (EPEL설치하여 SCL 리포지토리 활성화가 우선되어야 함)
$ yum clean all
$ yum makecache
$ yum install epel-release -y
$ yum install centos-release-scl -y
$ yum update policycoreutils policycoreutils-python -y
$ yum update audit-libs audit-libs-python -y
$ yum install devtoolset-9 -y 
$ source /opt/rh/devtoolset-9/enable
- 설치된 GCC9 환경 활성화
$ gcc --version
- GCC 버전 확인


3. MeCab 본체 설치
$ curl -LO https://mecab.googlecode.com/files/mecab-0.996.tar.gz
$ tar zxvf mecab-0.996.tar.gz
$ cd mecab-0.996
$ ./configure
$ make
$ make install
$ ldconfig

4. MeCab-ko-dic (한국어 사전) 설치
$ cd ..
$ curl -LO https://bitbucket.org/eunjeon/mecab-ko-dic/downloads/mecab-ko-dic-2.1.1-20180720.tar.gz
$ tar zxvf mecab-ko-dic-2.1.1-20180720.tar.gz
$ cd mecab-ko-dic-2.1.1-20180720
$ ./configure --with-mecab-config=/usr/local/bin/mecab-config
$ make
$ make install


5. Python 가상환경 활성화시 자동 설정
$ source wordcloud_env/bin/activate

(wordcloud_env) $ vi /home/doumdoc/py_wordcloud/wordcloud_env/bin/activate
-- 맨 상단에 추가
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk
export PATH=$JAVA_HOME/bin:$PATH
source /opt/rh/devtoolset-9/enable


6. 한글 워드 클라우드에 필요한 라이브러리 설치
(wordcloud_env) $ pip3 install --upgrade pip setuptools wheel
(wordcloud_env) $ pip3 install wordcloud matplotlib
(wordcloud_env) $ pip3 install --no-binary :all: --no-cache-dir JPype1==1.5.0
 (1) JPype1 설치가 성공했는지 확인
 (wordcloud_env) $ python -c "import jpype; print(jpype.__version__)" 
 (wordcloud_env) $ python -c "import jpype; jpype.startJVM()"

 (2) Python mecab-python3 설치 (Konlpy를 위한 파이썬 바인딩)
 (wordcloud_env) $ pip install mecab-python3

(wordcloud_env) $ pip3 install konlpy


7. 나머지 패키지들 설치
(wordcloud_env) $ pip3 install Pillow numpy pymysql


8. 실행
(wordcloud_env) $ python3 wordcloud_by_me.py


9. 폰트 설치 (선택사항)
$ curl -o onestore.zip https://www.onestorecorp.com/assets/fonts/ONE_Mobile_POP.zip
$ unzip -d /usr/share/fonts/onestore onestore.zip
$ fc-cache -fv
- 폰트 캐시 갱신

 

* 설치 중 에러사항 정리

https://antimidal.tistory.com/52

 

[Python] Python 한글 WordCloud 설치 오류 정리

파이썬 워드클라우드를 구축하기 위해 삽질을 하여, 이전 포스팅에서 최종 설치 방법을 정리하였음.https://antimidal.tistory.com/51 [Python] Python WordCloud (한글) 파이썬 한글 워드클라우드 클린 설치리눅

antimidal.tistory.com

 

반응형
728x90

두 개 이상의 카메라로 촬영을 하거나 음향 개선을 위해 카메라와 녹음을 따로 한 경우,
여러 개의 채널의 타이밍을 맞추기 위해 동기화 기능을 사용하면 쉽게 할 수 있다.
오디오의 음파를 기준으로 매칭해주는데, 일일이 소리를 듣고 음파 파형을 찾아가면서 수작업하기보다 훨씬 빠르고 정확하다.

1. 두 개의 오디오 채널을 선택
2. 우클릭 - 동기화 선택
3. 오디오 트랙 채널을 선택 (기준이 되는 채널을 선택) - 확인
4. 3개 이상의 동기화는 두 개씩 선택해서 동기화를 진행

프리미어 채널 선택 후 우클릭 - 동기화 메뉴
클립 동기화 설정 창에 오디오 트랙 채널 선택 후 확인으로 동기화 실행
오디오 기준으로 동기화가 완료된 시퀀스

 

참조 : https://www.youtube.com/watch?v=InS7mt598GQ&t=2s

반응형
728x90

앱을 업데이트하기 위해 앱번들을 이미 업로드 하였는데,
뒤늦게 수정사항이 발견되어 처리하고 버전 코드를 그대로 하여,
다시 업로드를 하려니 업로드를 실패하였음.

이미 올라간 버전코드 4와 충돌되어 업로드 실패

수정하기 직전에 올라간 앱번들은 쓸모없이 앱번들 탐색기만 복잡하게 만들고,
버전 코드를 다시 수정해서 파일 만들기도 번거롭기 때문에 이미 올라가 있던 앱번들 파일을 삭제하고자 함.

App Bundle 탐색기에서 삭제할 버전 코드 화살표 클릭  >  앱번들 상세 페이지에서 app bundle 삭제.

그런데 앱번들이 이미 사용중이면, 삭제 버튼이 보이지 않음.
프로덕션 버전 만드는 중에 임시저장이라도 되어 있으면, 삭제 버튼이 보이지 않으므로
임시 저장된 프로덕션 버전을 삭제 -임시출시 삭제- 하고, 위를 다시 시도하면 삭제 버튼이 생김.

app bunddle 삭제 버튼으로 앱번들 삭제
app bunddle이 사용중이면 삭제 불가하므로, 임시출시 삭제를 먼저 처리 후 app bunddle 삭제를 시도할 것

반응형
728x90

안드로이드 앱은 구글 플레이 스토어에서, 아이폰 앱은 앱스토어에서 앱을 내리는 방법, 숨기는 방법을 정리함

1. [안드로이드] 구글 플레이 스토어
  1) 플레이 구글 콘솔(https://play.google.com/console)에 접속
  2) 테스트 및 출시 > 고급 설정 > 앱 이용 가능여부 > "출시 안됨" 으로 변경

  3) 혹시 "출시 안됨"이 비활성화 되어 있다면, 게시 개요에서 관리 게시가 활성화 되어 있을 가능성이 큼. 관리 게시 비활성화 후 다시 처리.

 

2. [ios 아이폰] 앱 스토어
  1) 앱스토어 컨넥트 (https://appstoreconnect.apple.com/) 접속
  2) 앱 선택 후, 수익화 > 가격 및 사용 가능 여부 > 맨 하단에 "앱 판매 중단" 클립

반응형
728x90

MAC에서 flutter로 앱을 개발하기 위해서 셋팅하는 과정을 정리함.
일단 flutter를 설치하고 나면 flutter doctor 명령으로 추가적인 필요 사항을 체크할 수 있음.
크게 android studio, xcode, cocoapods를 추가로 설치하면 되는데, 중간중간 삽질이 필요함.

  1. flutter 설치
    1. 다운로드 및 설치
    2. SDK PATH 설정 (shell에 따라 구분)
  2. android Studio 설치
  3. Xcode 설치
  4. cocoapods 설치

1. flutter 설치

  1) 다운로드 및 설치
- flutter 사이트에서 (https://docs.flutter.dev/get-started/install) macOs용으로 다운로드 받음.
- MAC 프로세서에 따라 설치 가능한 버전을 다운로드함. (
Intel Processor or Apple Silicon )
- 다운 받은 압축 파일을 ~/development/ 폴더에 압축 해제하면 되는데, development 폴더 없으면 새로 생성하면 됨.

unzip ~/Downloads/flutter_macos_arm64_3.29.0-stable.zip \ -d ~/development/

또는
mkdir ~/development
cp flutter_macos_arm64_3.29.0-stable.zip ~/development/
unzip ~/development/flutter_macos_arm64_3.29.0-stable.zip

- 이렇게 하면, flutter/Dart의 SDK가 설치 완료되고, 아래의 두 패스를 사용하게 됨.

flutter SDK 패스 : /Users/유저명/development/flutter/bin
Dart SDK 패스 : /Users/유저명/development/flutter/bin/cache/dart-sdk (이건 android-studio에서 사용할 예정)

 

   2) PATH 설정 (shell에 따라 구분)

- 터미널에서 flutter 명령어를 바로 사용할 수 없기 때문에 PATH를 추가해야 함.

- 어떤 shell을 사용하는지에 따라 구분됨.

echo $SHELL   // 쉘 확인

// (1) zsh 쉘이면
vim ~/.zshrc   

    #Flutter PATH 설정 추가
    export PATH="플러터폴더경로/bin:$PATH"

source ~/.zshrc

// (2) bash 쉘이면 .zshrc 대신 .bash_profile 편집하고 적용

- 만약, 쉘이 꼬여서 해당 파일이 없는 경우에는 아래의 방법으로 쉘을 초기화하여 새로 생성하고, flutter 패스 입력함.

touch ~/.zshrc		// .zshrc 파일 생성
echo "export PATH=$PATH" > ~/.zshrc		// PATH 내용 초기화
source ~/.zshrc		// 서버에 적용

- flutter PATH 설정 후 버전 확인

- flutter doctor로 추가로 필요한 목록 확인
- android studio, xcode 설치 필요.



2. android Studio 설치

- https://developer.android.com/studio?hl=ko 에서 MAC용 android Studio 다운로드하여 설치

- android Studio 열어서 Dart, Flutter 패키지 설치.

- android Studio를 설치하였으나 licenses에 동의가 필요함.

flutter doctor --android-licenses

- adroid studio 설정에서 SDK Tools 중 Android SDK Command-line Tools 설치.

- android studio 설치 완료.

 


3. Xcode 설치

- https://developer.apple.com/download/all/  애플 사이트에서 xcode를 설치해야 함.
- MAC 프로세서와 버전에 따라 설치할 수 있는 xcode 버전이 있으므로 주의하여 찾아서 설치함 ( https://developer.apple.com/support/xcode/ )


4. cocoapods 설치

- Xcode를 설치하고서 cocoapods를 추가로 설치해야 함.

- homebrew가 설치되어 있지 않아, 오류 발생
- https://brew.sh/ko/ 사이트에서 설치함

- 여기까지 설치하면 flutter를 실행할 수 있는 준비가 완료됨.

 

[참고] https://docs.flutter.dev/get-started/install/macos/desktop#configure-xcode

[참고] https://wildeveloperetrain.tistory.com/358

[참고] https://semin1127.tistory.com/entry/MACFlutter-%ED%94%8C%EB%9F%AC%ED%84%B0-%EC%B4%88%EA%B8%B0-%EA%B0%9C%EB%B0%9C-%ED%99%98%EA%B2%BD-%EA%B5%AC%EC%B6%95-%EB%B0%A9%EB%B2%95

반응형
728x90

RHEL 계열 리눅스에서 유용했던 패키지 관리자 yum 의 업그레이드 버전인 dnf 사용법을 정리하고자 함.
yum과 사용법이 크게 차이나지 않음.

> dnf list "패키지명"*
> dnf list all
* 패키지 확인

> dnf install "패키지명"
* 패키지 설치

> dnf update
> dnf upgrade
* 모든 패키지 업데이트 (업그레이드)

> dnf upgrade "패키지명"
* 특정 패키지 업데이트 (업그레이드)

> dnf remove "패키지명"
* 패키지 삭제

> dnf list installed
* 설치된 패키지 확인

> dnf list installed "패키지명"
* 설치된 패키지중 특정 패키지 확인

> dnf list available "패키지명"
* 사용 가능한 패키지중 특정 패키지 확인   

> dnf history list
* dnf 사용기록 리스트

> dnf search "패키지명"
* 특정 패키지명 검색

기본 제공되는 패키지들이 아닌 경우 리포지토리(저장소)를 변경해야 하는 경우가 발생함.
리포지토리를 확인하고, 변경하는 예시를 아래에 작성함.

 

> dnf repolist 
* 설치된 저장소 리스트 확인

** PHP 버전 업그레이드를 예시
> dnf module reset php
* 모듈 상태 초기화

> dnf module list php
* php를 설치할 수 있는 저장소 리스트 확인

> dnf module enable php:remi-8.0
* php를 설치하고자 하는 저장소 활성화

> dnf install php
* 설치시 선택된 php 버전 설치

 

반응형
728x90

flutter 학습을 위해 기록함.
앱을 시작할때 첫 화면, 즉 스플래시를 만들기 위해 flutter_native_splash 패키지를 사용함.

1) 패키지 설치

 

 flutter pub add flutter_native_splash

2) 환경설정 파일 생성
루트 프로젝트 디렉토리에 flutter_native_splash.yaml 파일 생성하여, 아래 내용을 추가함.
- color 값과 image 경로를 원하는대로 설정

flutter_native_splash:
  # This package generates native code to customize Flutter's default white native splash screen
  # with background color and splash image.
  # Customize the parameters below, and run the following command in the terminal:
  # dart run flutter_native_splash:create
  # To restore Flutter's default white splash screen, run the following command in the terminal:
  # dart run flutter_native_splash:remove

  # IMPORTANT NOTE: These parameter do not affect the configuration of Android 12 and later, which
  # handle splash screens differently that prior versions of Android.  Android 12 and later must be
  # configured specifically in the android_12 section below.

  # color or background_image is the only required parameter.  Use color to set the background
  # of your splash screen to a solid color.  Use background_image to set the background of your
  # splash screen to a png image.  This is useful for gradients. The image will be stretch to the
  # size of the app. Only one parameter can be used, color and background_image cannot both be set.
  color: "#42a5f5" // 배경색깔
  #background_image: "assets/background.png"

  # Optional parameters are listed below.  To enable a parameter, uncomment the line by removing
  # the leading # character.

  # The image parameter allows you to specify an image used in the splash screen.  It must be a
  # png file and should be sized for 4x pixel density.
  image: assets/img/splash_768.png   // 스플래시 이미지를 사용할 경우, 주석 풀고 이미지 경로

  # The branding property allows you to specify an image used as branding in the splash screen.
  # It must be a png file. It is supported for Android, iOS and the Web.  For Android 12,
  # see the Android 12 section below.
  #branding: assets/dart.png

  # To position the branding image at the bottom of the screen you can use bottom, bottomRight,
  # and bottomLeft. The default values is bottom if not specified or specified something else.
  #branding_mode: bottom
  
  # Set the branding padding from the bottom of the screen.  The default value is 0
  # (Not supported on web yet)
  # branding_bottom_padding: 24

  # The color_dark, background_image_dark, image_dark, branding_dark are parameters that set the background
  # and image when the device is in dark mode. If they are not specified, the app will use the
  # parameters from above.  If there is no parameter above, the app will use the light mode values.
  # If the image_dark parameter is specified, color_dark or background_image_dark must be specified.  
  # color_dark and background_image_dark cannot both be set.
  #color_dark: "#042a49"
  #background_image_dark: "assets/dark-background.png"
  #image_dark: assets/splash-invert.png
  #branding_dark: assets/dart_dark.png

  # From Android 12 onwards, the splash screen is handled differently than in previous versions.
  # Please visit https://developer.android.com/guide/topics/ui/splash-screen
  # Following are specific parameters for Android 12+.
  android_12:
    # The image parameter sets the splash screen icon image.  If this parameter is not specified,
    # the app's launcher icon will be used instead.
    # Please note that the splash screen will be clipped to a circle on the center of the screen.
    # App icon with an icon background: This should be 960×960 pixels, and fit within a circle
    # 640 pixels in diameter.
    # App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle
    # 768 pixels in diameter.  To fit a 1152x1152 image within a circle with a 768 diameter, simply 
    # ensure that the most important design elements of your image are placed within a circular area
    # with a 768 diameter at the center of the 1152x1152 canvas.
    image: assets/img/splash_1152.png  // 스플래시 이미지를 사용할 경우, 주석 풀고 이미지 경로

    # Splash screen background color.
    color: "#42a5f5" // 배경색깔

    # App icon background color.
    #icon_background_color: "#111111"

    # The branding property allows you to specify an image used as branding in the splash screen.
    #branding: assets/dart.png

    # The image_dark, color_dark, icon_background_color_dark, and branding_dark set values that
    # apply when the device is in dark mode. If they are not specified, the app will use the
    # parameters from above.  If there is no parameter above, the app will use the light mode values.
    #image_dark: assets/android12splash-invert.png
    #color_dark: "#042a49"
    #icon_background_color_dark: "#eeeeee"

  # The android, ios and web parameters can be used to disable generating a splash screen on a given
  # platform.
  #android: false
  #ios: false
  #web: false

  # Platform specific images can be specified with the following parameters, which will override
  # the respective parameter.  You may specify all, selected, or none of these parameters:
  #color_android: "#42a5f5"
  #color_dark_android: "#042a49"
  #color_ios: "#42a5f5"
  #color_dark_ios: "#042a49"
  #color_web: "#42a5f5"
  #color_dark_web: "#042a49"
  #image_android: assets/splash-android.png
  #image_dark_android: assets/splash-invert-android.png
  #image_ios: assets/splash-ios.png
  #image_dark_ios: assets/splash-invert-ios.png
  #image_web: assets/splash-web.gif
  #image_dark_web: assets/splash-invert-web.gif
  #background_image_android: "assets/background-android.png"
  #background_image_dark_android: "assets/dark-background-android.png"
  #background_image_ios: "assets/background-ios.png"
  #background_image_dark_ios: "assets/dark-background-ios.png"
  #background_image_web: "assets/background-web.png"
  #background_image_dark_web: "assets/dark-background-web.png"
  #branding_android: assets/brand-android.png
  #branding_bottom_padding_android: 24
  #branding_dark_android: assets/dart_dark-android.png
  #branding_ios: assets/brand-ios.png
  #branding_bottom_padding_ios: 24
  #branding_dark_ios: assets/dart_dark-ios.png
  #branding_web: assets/brand-web.gif
  #branding_dark_web: assets/dart_dark-web.gif

  # The position of the splash image can be set with android_gravity, ios_content_mode, and
  # web_image_mode parameters.  All default to center.
  #
  # android_gravity can be one of the following Android Gravity (see
  # https://developer.android.com/reference/android/view/Gravity): bottom, center,
  # center_horizontal, center_vertical, clip_horizontal, clip_vertical, end, fill, fill_horizontal,
  # fill_vertical, left, right, start, or top. android_gravity can be combined using the | operator to achieve multiple effects. 
  # For example:
  # `android_gravity: fill|clip_vertical` - This will fill the width while maintaining the image's vertical aspect ratio
  #android_gravity: center
  #
  # ios_content_mode can be one of the following iOS UIView.ContentMode (see
  # https://developer.apple.com/documentation/uikit/uiview/contentmode): scaleToFill,
  # scaleAspectFit, scaleAspectFill, center, top, bottom, left, right, topLeft, topRight,
  # bottomLeft, or bottomRight.
  #ios_content_mode: center
  #
  # web_image_mode can be one of the following modes: center, contain, stretch, and cover.
  #web_image_mode: center

  # The screen orientation can be set in Android with the android_screen_orientation parameter.
  # Valid parameters can be found here:
  # https://developer.android.com/guide/topics/manifest/activity-element#screen
  #android_screen_orientation: sensorLandscape

  # To hide the notification bar, use the fullscreen parameter.  Has no effect in web since web
  # has no notification bar.  Defaults to false.
  # NOTE: Unlike Android, iOS will not automatically show the notification bar when the app loads.
  #       To show the notification bar, add the following code to your Flutter app:
  #       WidgetsFlutterBinding.ensureInitialized();
  #       SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.bottom, SystemUiOverlay.top], );
  #fullscreen: true

  # If you have changed the name(s) of your info.plist file(s), you can specify the filename(s)
  # with the info_plist_files parameter.  Remove only the # characters in the three lines below,
  # do not remove any spaces:
  #info_plist_files:
  #  - 'ios/Runner/Info-Debug.plist'
  #  - 'ios/Runner/Info-Release.plist'

3) 패키지를 실행

dart run flutter_native_splash:create

* 단, 파일명이 기본 flutter_native_splash.yaml이 아니면, 아래와 같이 파일명으로 패키지를 실행

dart run flutter_native_splash:create --path=path/my/myfile.yaml

 

*참조 : [공식]https://pub.dev/packages/flutter_native_splash

반응형
728x90

flutter로 개발된 앱일 경우 apk 파일을 추출하여
안드로이드 폰에 직접 설치하고, 테스트를 진행하기 위해 apk 파일을 추출함.

> flutter build apk --release --target-platform=android-arm64

...
√ Built build\app\outputs\flutter-apk\app-release.apk (*.*MB)

프로젝트 폴더로 이동 후에 해당 명령어를 실행하면
해당 폴더 아래에 build\app\outputs\flutter-apk 폴더가 생성되고 apk 파일이 저장됨.

[참조] https://blog.dglee.co.kr/37


테스트를 완료하고 안드로이드 앱을 구글 플레이스토어에 올려서 배포하기 위해서는 다른 형식의 파일이 필요함
aab 파일을 생성해야 함.

반응형
728x90

flutter 학습을 위해 기록함.
안드로이드 앱에서 restful API를 연동하여 데이터 값을 처리하기 위해 필요한 AES-256 암호화 및 복호화 코드


1) flutter 패키지 encrypt 설치

pub global activate encrypt

2) 코드 작성

import 'package:encrypt/encrypt.dart' as encrypt;

class MyCrypt {

  // 암호화
  static String AES_encrypt(String normalData) {
    final key = encrypt.Key.fromUtf8('암호화키로 사용될 32byte 길이의 문자열');
    final iv = encrypt.IV.fromUtf8('IV값으로 사용될 16byte 길이의 문자열');

    final encrypter = encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
    final encrypted = encrypter.encrypt(normalData, iv: iv);
    
    return encrypted.base64;
  }

  // 복호화
  static String AES_decrypt(String encryptedData) {
    final key = encrypt.Key.fromUtf8('암호화키로 사용될 32byte 길이의 문자열');
    final iv = encrypt.IV.fromUtf8('IV값으로 사용될 16byte 길이의 문자열');

    final encrypter = encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
    final decrypted = encrypter.decrypt(encrypt.Encrypted.from64(encryptedData), iv: iv);

    return decrypted;
  }
  
}


// 사용
var encodeData = MyCrypt.AES_encrypt('암호화할 문자열');
var decodeData = MyCrypt.AES_decrypt(encodeData); // 암호화된 문자열

 

3) 팁

iv값의 길이는 암호화키보다 짧으므로, 암호화키 문자열에서 추출하여 사용하는 것도 가능함.
단, 암/복호화에 사용되는 key와 iv값은 동일해야 정상적인 복호화가 됨.

var keyString = '32byte길이의 암호화키 문자열';

final key = encrypt.Key.fromUtf8(keyString);
final iv = encrypt.IV.fromUtf8(keyString.toLowerCase().substring(0, 16));

 

참조
[공식] https://pub.dev/packages/encrypt
https://link2me.tistory.com/2215

 

4) 오류 및 디버깅

Invalid or corrupted pad block using encrypt package

sol.> 암호화키 문자열의 길이에 따라 AES 암호화 방식이 구분됨.
        16byte -> AES-128, 24byte  ->  AES-192, 32byte  ->  AES-256
        키 문자열 길이가 16, 24, 32byte 이중에 하나도 아니면, 에러가 발생함.

* 참조 https://kkh0977.tistory.com/6307

flutter/runtime/dart_vm_initializer.cc(41)] unhandled exception: invalid argument(s): input buffer too short

sol> 서버와 연동을 하려다보니 복호화부터 진행해야 했고, 다시 암호화하려니 위와 같은 에러가 발생함. 이에 대한 원인은 키값의 길이가 맞지 않아서 라고 이미 stackoverflow에서 언급되고 있음.
( https://stackoverflow.com/questions/70817666/invalid-arguments-input-buffer-too-short-and-invalid-or-corrupted-pad-block)
        그런데 암호화 키값, iv값 길이 모두 확인해봐도 이상이 없음.
        결국 찾아낸 원인은 암호화 처리 할때, padding 옵션과 평문의 길이가 매칭되지 않아서 오류가 발생되었음.

final encrypter = encrypt.Encrypter(encrypt.AES(
    encrypt.Key.fromUtf8(encryptKey),
    mode: encrypt.AESMode.cbc,
    padding: null,
));  // 오류가 발생된 코드

      padding: null은 평문의 길이가 16바이트의 배수가 아니면 encrypt 메서드에서 오류가 발생할 수 있다고 함. 해결책은 제거하거나 옵션을 Pkcs7Padding()를 사용하면 됨. 난 제거 했음.

반응형

+ Recent posts