작업 상태

- 소개 페이지에 나온것처럼 npx create-expo-app AwesomeProject, npx expo start 을 이용해서 작업을 진행하고, 

npx expo run:android를 실행하던중 문제가 발생했습니다.

 
에러 메시지 
requireNativeComponent: "RNSScreen" was not found in the UIManager.


원인
정확한 원인 발견하지 못했습니다. 단지 expo로 만든 프로젝트 초기에는 android native 코드가 없다가 npx expo run:android를 실행하면 android native코드가 생성되는데 이게 현재 사용중인 버전과 다른듯합니다.

 

cd AwesomeProject
npx expo start 또는
expo start 

기초적인 hello 만들때까지도 괜찮았습니다.
npx expo run:android 잘 실행됐습니다.

 

그런데
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native'; 
이것을 쓰기 시작하면서 이것을 실행하면 RNSScreen에러가 나오기 시작했습니다.
requireNativeComponent: "RNSScreen" was not found in the UIManager.

 

처리

>> 기본적으로 
npx expo install react-native-screens react-native-safe-area-context 
이거랑 gesture 설치하면 동작한다고 하는 곳들이 있었지만 저는 다 실패했습니다.

 

결국 expo 에서는 해결 못하고 우회했습니다.
] npx create-react-native-app CPlayer
] expo install react-native-screens react-native-safe-area-context ...
혹시 몰라서 관련 패키지를은 전부 expo install로 설치했습니다.
] npx expo run:android

우회한 경우에는 특이사항 없이 잘 동작했습니다.

참고

https://docs.expo.dev/

 

Expo Documentation

 

docs.expo.dev

문제 발생시 package.json

{
  "name": "cxcer",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-community/datetimepicker": "6.7.3",
    "@react-native-picker/picker": "2.4.8",
    "@react-navigation/bottom-tabs": "^6.5.7",
    "@react-navigation/native": "^6.1.6",
    "expo": "~48.0.10",
    "expo-background-fetch": "~11.1.1",
    "expo-constants": "~14.2.1",
    "expo-notifications": "~0.18.1",
    "expo-splash-screen": "~0.18.1",
    "expo-status-bar": "~1.4.4",
    "expo-task-manager": "~11.1.1",
    "loadsh": "^0.0.4",
    "react": "18.2.0",
    "react-native": "0.71.6",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "~3.20.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

작업 상태

- 안드로이드 개발 폰에 임시 apk를 만들어서 설치하려고 하는데 발생한 에러 입니다.

  
에러 메시지 
adb로 설치시 
adb: failed to install .\app-debug.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.a3040 signatures do not match previously installed version; ignoring!]

 

bundletool 로 설치시
E/SplitApkInstallerBase: Failed to commit install session 1461821388 with command cmd package install-commit 1461821388. Error: INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.a3040 signatures do not match previously installed version; ignoring!
[BT:1.14.0] Error: Installation of the app failed.


원인

- 이 오류는 패키지의 서명(Signature)이 이전에 설치된 버전과 다른 경우에 발생합니다. 즉, 같은 패키지 이름(com.a3040)이지만 다른 개발자가 만든 앱인 경우나, 이전에 설치한 앱을 개발자가 임의로 서명을 변경해서 배포하는 경우 등이 해당합니다.

해결 방법으로는 이전에 설치된 버전을 삭제한 후, 새로운 버전을 설치하면 됩니다.

처리

- 스마트폰에서 기존에 설치한 개발 관련 앱을 삭제합니다.

- java -jar .\bundletool-all-1.14.0.jar install-apks --apks=app2.apks  apks 를 이용해서

-adb install app2.apk adb를 이용해서

참고

adb는 Android Debug Bridge의 약자로, 안드로이드 디바이스와 컴퓨터를 연결하여 디바이스에 명령어를 전송하고 데이터를 주고 받을 수 있는 도구입니다.

- 간단한 명령어는 몇가지는 다음과 같습니다:

  • adb devices: 현재 연결된 디바이스 목록을 보여줍니다.
  • adb install <apk file>: APK 파일을 디바이스에 설치합니다.
  • adb uninstall <package name>: 해당 패키지를 디바이스에서 제거합니다.
  • adb shell: 디바이스 쉘에 접속합니다.
  • adb push <local> <remote>: 로컬 파일을 디바이스에 복사합니다.
  • adb pull <remote> <local>: 디바이스 파일을 로컬로 복사합니다.
  • adb logcat: 로그를 보여줍니다.

bundletool은 Android 앱 번들을 생성하고, APK 파일을 만들고, 그리고 APK를 최적화하는 도구입니다.

- 간단한 bundletool 명령어입니다:

  • build-bundle: App Bundle 파일을 생성합니다.
  • build-apks: APK set 파일을 생성합니다. --connected-device 옵션을 추가하면 현재 연결된 기기에 바로 설치할 수 있습니다.
  • install-apks: 생성된 APK set 파일을 설치합니다.

- bundletool build-apks --bundle=app.aab --output=app.apks --mode=universal
- bundletool install-apks --apks=app.apks

 

 

작업 상태

application.properties 에서 값을 가져오는 과정에서 발생했습니다.


에러 메시지

java.nio.file.InvalidPathException: Trailing char < > at index 53: C:\Us......40\upload

원인

- 끝에 안보이는 공백이 있었습니다.

처리

 

application.properties
에러 상태

...
upload.folder=C:\\Us........pload <--뒤에 숨은 공간
...

 


수정 상태

...
upload.folder=C:\\Us........pload<--뒤에 숨은 공간
...


특이사항 없음.

작업 상태

- 스프링으로 파일첨부 작업을 하던중, Controller쪽에 있던 설정을 Service쪽으로 옮긴후에 발생한 에러입니다.

- Controller에서는 동작하던 상태였습니다.

- application.properties 설정 upload.folder=, 실제 위치 확인 완료 
 
에러 메시지 

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fileUploadController' defined in file

 Unsatisfied dependency expressed through constructor parameter 0

 

원인

Spring 컨텍스트가 아직 초기화되지 않은 상태에서 StorageService 인스턴스가 생성되어서 발생하는 문제입니다.

 

처리

에러발생상태 코드


    @Service
    public class StorageService {
   
        @Value("${upload.folder}")
        private String uploadFolder;
   
        private final Path rootLocation;
   
        public StorageService() {
            this.rootLocation = Paths.get(uploadFolder);  //문제 발생부분
        }
...

처리 상태


@Service
public class StorageService {
    @Value("${upload.folder}")
    private String uploadFolder;
   
    private Path rootLocation;

    public StorageService() {    
        this.rootLocation = null;
    }
   
    @PostConstruct
    public void init() {
        this.rootLocation = Paths.get(uploadFolder);
    }

@PostConstruct 어노테이션이 붙은 메서드는 해당 클래스의 인스턴스 생성 및 DI가 완료된 후, 초기화 작업을 수행하기 위해 호출되는 메서드입니다.

@Value 어노테이션을 사용하면, 스프링 컨테이너가 빈을 생성할 때 주입하려는 값을 설정 파일(application.properties 또는 application.yml) 등 외부의 설정 파일에서 가져와서 주입할 수 있습니다.


참고

Getting Started | Uploading Files (spring.io)

 

Spring | Home

Cloud Your code, any cloud—we’ve got you covered. Connect and scale your services, whatever your platform.

spring.io

 

 

+ Recent posts