묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
기본키 매핑
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]영한님께서는 @GeneratedValue의 속성값을 auto로 설정해서 h2 데이터베이스에 맞는 기본키전략, 즉 시퀀스 전략을 사용했습니다. 하지만 저는 Identity 전략으로 사용이 되는데 무슨 이유일까요? auto로 해도 Identity 전략, @GeneratedValue의 속성값을 시퀀스로 설정해도 Identity전략으로 됩니다.
-
미해결차량 번호판 인식 프로젝트와 TensorFlow로 배우는 딥러닝 영상인식 올인원
faster_rcnn_oxford_iiit_pet_training
colab 실습 중 에러가 나서 문의 드립니다.ModuleNotFoundError: No module named 'tensorflow.python.keras.applications'가 나서 !apt install --allow-change-held-packages libcudnn8=8.1.0.77-1+cuda11.2실행하고 런타임 재시작 해봤는데 같은 에러가 뜹니다!해결 방법 알려주실 수 있을까요?
-
미해결스프링 시큐리티
AbstractSecurityInterceptor 실습
AbstractSecurityInterceptor.java 에 중단점을 걸어놓고 루트경로인 localhost:8080/ 으로 접속을 시도했는데abstractSecurityIntercepter 의 중단점으로 디버깅흐름이 이동하지 않습니다.혹시 GlobalMethodSecurity 설정과 관련이 있는 문제인가요? (어떤 커뮤니티에서 힌트만 들었습니다)
-
미해결배달앱 클론코딩 [with React Native]
지도 현재 위치, 이미지가 보이지 않습니다.
아래 질문에서 유사한 문제가 있어서 답변 내용처럼 했는데 해결이 안되고 있습니다!- pod에서 네이버지도 3.10.0을 설치 -> 완료- 해외로 찍혀있는 것은 아닌지? -> 거리함수로 확인해보니 해외로 찍혀있을 수 있을 것 같습니다.이 경우에 현재 위치로 돌릴 수 있는 방법이 있을까요? myLocation 옵션 true로 추가해서 확인해도 옮겨지지가 않습니다. 추가로 확인해봐야하는 부분이 있을까요?
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
OrderItem이 item의 id(pk)를 fk를 가지는 방식으로 매핑할때 문제점
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]Order, Item이 있고. Order와 Item사이의 다대다 관계를 풀기 위해서 OrderItem이 존재합니다.이때, OrderItem은 Order의 pk와 Item의 pk를 갖습니다. 위와 같은 상황에서. OrderItem에 들어가있는 Item을 삭제하려고 하면. 삭제를 할 수 없다는 문제점이 발생할 것 같습니다. Item을 삭제하면. 과거주문내역(즉, OrderItem)을 조회했을때 Item이 다 null로 나오겠죠. 애초에 참조무결성이 깨지기 때문에 삭제가 안될지도 모르겠습니다. 또는, Item을 삭제할때 연관되어있는 모든 OrderItem역시 같이 지워야 한다거나요.게다가, 이는 비즈니스 정책에 따라 다르겠지만. item의 이름을 변경할 경우. 과거 모든 주문내역에서 item의 이름이 변경된다는 단점도 있습니다. 클라이언트가 이를 원할 수 도 있겠으나. 개인적으로는 이미 판매한 주문내역의 item 이름이 변경되는것은 어색하다고 생각합니다. 저의 질문은. 실무에서, 현장에서는 Order와 Item사이의 연관관계를 어떻게 처리하고 있는지 궁금합니다. 어떻게 처리하는지에 따라 delete와 update의 작동 방식이 달라진다고 생각하기 때문입니다. 저 스스로 생각해본 방식으로는 두가지가 있습니다.첫번째는, OrderItem에서 Item Long id(pk)가 아닌 Item의 String name을 들고 있는 것 입니다. 이 경우. Item이 삭제되어도, name으로 itemRepository.findByName(name)를 이용해 데이터를 조회합니다. 하지만 name으로 entity를 식별해야하므로. name이 유니크해야하며. name이 같으면 동일한 entity로 보기때문에, 한번 삭제했다가 같은이름으로 다시 item을 만들경우 이 둘을 동일하게 취급한다는 문제점이 있을것 같습니다. update관점에서는, item Long id(pk)가 아닌 item의 name을 들고있기 때문에. item을 업데이트 하더라도, 과거 주문내역의 item들의 이름이 바뀌지 않을 것입니다.두번째는, 삭제를 하지 않는 것입니다. 대신 pseudo삭제를 구현합니다. entity에 Boolean enable;과 같은 필드를 만들고. 이 필드값의 T/F 여부에 따라 pseudo삭제되었는지 아닌지 판별합니다. item의 name이 같은 List<Item>에서 최대 하나의 item만 enable true상태를 갖도록 합니다. 이렇게 했을경우 각 OrderItem(주문내역)은 각각 다른 item과 pk로 매핑되어 있기 때문에, 가장 최신에 사용하고 있는(enable=true)인 item을 업데이트하더라도 과거 주문내역에 영향을 끼치지 않습니다. 또한 실제로 db에서 데이터를 삭제하는 것이 아니기 때문에. 과거 내역을 조회할때 item = null인 상황도 발생하지 않을 것입니다. 단, db에 delete를 날리지 않으니 데이터가 계속 쌓인다는 단점이 있을것 같습니다. 위의 두가지 방법은 그저 재가 생각해본 방법에 불과하고. 올바른 방법이 있다면 알려주세요. 부탁드립니다 선생님.질문이 장황하고 굉장히 길었습니다. 읽어주셔서 너무나 감사합니다.
-
미해결[초급편] 안드로이드 커뮤니티 앱 만들기(Android Kotlin)
게시글 content text가 안 나옵니다.
현재 강의는 '게시글 삭제 만들기'까지 듣고 코딩했어요. 게시글 삭제와 수정은 되는데 문제는 게시판에서 게시글을 누르면 firebase key값이 나옵니다.왜 content 부분이 안나올까요? (((사진업로드도 잘됩니다. 내용만 안나와요. )))
-
미해결홍정모의 따라하며 배우는 C++
string& 과string 차이
8.9 클래스와 const 14분에서 클래스 메소드를 만들때 const string& getValue() 나string& getValue() 이런식으로 선언하셨는데그냥 string getValue() 와 무슨 차이가 있는지 궁금합니다..
-
미해결그로스해킹 - 데이터와 실험을 통해 성장하는 서비스를 만드는 방법
인프런 파이썬 추천 강의가 있나요?
상동
-
미해결[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!
flutter upgrade 후에
제 스마트폰으로 연결해서 항상 build를 했었는데,flutter upgrade 후에, The Flutter device daemon cannot be started. Please check your configuration and restart the IDE 이런에러가 뜨면서 안됩니다 ㅠflutter doctor를 해보니, oops; flutter has exited unexpectedly: "filesystemexception: creation failed, 이렇게나오네요 ㅠ해결방법이 무엇이죠 ?ㅠ
-
미해결[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part1: C# 기초 프로그래밍 입문
오버로딩 + 선택적 매개변수 관련 질문
아래와 같은 경우 a, b 만 매개변수로 입력하면 컴터는 어떤 걸 기본으로 쓰나요?선택적 매개변수가 없는 것을 기본으로 사용하는지?선택적 매개변수가 있는 것을 사용하게 하고 싶으면 어떻게 하는지? 궁금합니다.
-
해결됨실전! 스프링 데이터 JPA
도메인 컨버터 에러
여기서 findMember2메서드가 왜 에러가 나는 지 궁금합니다.
-
해결됨스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
이클립스 프로그램에서 시작부터 오류가 생깁니다.
[질문 내용]인텔리제이 또는 이클립스로 사용할 수 있다고 하셔서, 저는 이클립스로 시작했습니다.이클립스에 들어가서 File - open Projects from File System 으로 들어가서 'hello-spring' 폴더를 등록했는데 아래와 같은 'Java Problems' 오류가 뜹니다. java 버전을 11로 했는데도(build path) 변함이 없는데, 무엇이 문제인지, 해결 방법이 무엇인지 도움을 부탁드립니다.
-
미해결스프링 MVC 1편 - 백엔드 웹 개발 핵심 기술
12분 Error parsing HTTP request header
안녕하세요:) 강의 잘 듣고 있습니다.📌 (실행 시 결과는 강사님과 같게 나오지만) 12분 postman을 이용해서 post로 body에 내용을 담아 전달하면 Error parsing HTTP request header가 뜨는 이유가 궁금해서 질문 작성합니다.! 📌 검색 해 보니 " Java WAR로 배포한 Web Application에서 검색조건에 특수문자를 강제한 경우 크롬과는 다르게 인터넷 익스플로러(IE)에서는 에러 발생 및 에러페이지 호출 "위와 같이 나오는데, 이렇게 이해하면 되는건가요? 📌 만약 postman에서 url 입력 후 send 했을 때 이와 같은 에러가 뜨지 않게 하려면 어떻게 해야할까요? 에러 내용입니다. DEBUG 5756 --- [nio-8080-exec-1] o.apache.coyote.http11.Http11Processor :Error parsing HTTP request header java.io.EOFException: null at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1340) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1227) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:805) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:360) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:271) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1789) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.65.jar:9.0.65] at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
-
미해결Vue.js 완벽 가이드 - 실습과 리팩토링으로 배우는 실전 개념
깃 권한요청드립니다.
인프런 아이디 : hj1013.oh@gmail.com인프런 이메일 : hj1013.oh@gmail.com깃헙 아이디 : hj1013.oh@gmail.com깃헙 Username : lpwz
-
미해결스프링 핵심 원리 - 고급편
블로그 정리
안녕하세요. 영한님디자인 패턴 내용에 대해서 블로그에 정리하고자 하는데 영한님이 제공해주신 문서랑 영상 참고해서 작성해도 될까요? 출저는 남기겟습니다
-
미해결자바(Java) 알고리즘 문제풀이 입문: 코딩테스트 대비
어디가 오류인지 모르겠습니다.
import java.util.Scanner;public class exam8 { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int N = sc.nextInt(); int[] arr = new int[N]; for(int i=0; i<N; i++) { int a = sc.nextInt(); arr[i] = a; } for(int i=0; i<N; i++) { int count = 1; for(int j=0; j<N; j++) { if(arr[j]>arr[i]){ count++; } } arr[i] = count; } for(int i=0;i<arr.length;i++) { System.out.print(arr[i]+" "); } } } 출력값이 아무리 봐도 왜 4 3 2 1 1 이 나오는지 모르겠습니다 .
-
미해결[개정판] 파이썬 머신러닝 완벽 가이드
산탄대르 인코딩 방식
안녕하세요. 강의 잘 듣고 있습니다 :) 분류 실습 1 : 캐글경연대회의 산탄데르 은행 고객 만족 예측 - 012분 40초 에서 encoding = 'latin-1 ' 로 설정을 해주시는데요. utf-8-sig 로 인코딩 지정을 해줘도 되는데 왜 여기서 latin-1 로 지정해준 것인지 궁금합니다. 따로 latin-1 로 지정하는 특정한 경우가 있는지 궁금합니다. 감사합니다.
-
미해결
vector 초기화 질문입니다.
#include <iostream>#include <vector>#include <set>#include <cstring>#include <algorithm>using namespace std;template <typename T>void debug(vector<vector<T>> a){ cout << "-----------------------\n"; for (int i = 0; i < a.size(); ++i) { for (int j = 0; j < a[i].size(); j++) { cout << a[i][j] << " "; } cout << "\n"; } cout << "-----------------------\n";}set<int> data_H;vector<vector<int>> vec;int visited[101][101]; // 2차 배열vector<vector<int>> visited; //vector로 동적할당int M, val, cnt, ans;int dr[4] = { 0 , -1 , 1 , 0 };int dc[4] = { -1 , 0 , 0 , 1 };int nr, nc;void dfs(int r, int c, int val){ visited[r][c] = true; for (int i = 0; i < 4; i++) { nr = r + dr[i]; nc = c + dc[i]; if (nr < 0 || nc < 0 || nr >= M || nc >= M)continue; if (vec[nr][nc] <= val) continue; if (visited[nr][nc]) continue; dfs(nr, nc, val); } return;}int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> M; vec.resize(M, vector<int>(M,0)); visited.resize(M, vector<int>(M,0)); //vector 사이즈입력에 맞춰 셋팅 및 초기화 int input; for (int i = 0; i < M; ++i) { for (int j = 0; j < M; ++j) { cin >> input; vec[i][j] = input; data_H.insert(input); } } //debug(vec); //cout << sizeof(vec); //cout << sizeof(visited); for (auto c : data_H) { memset(&visited, false,sizeof(visited)); fill(visited.begin(), visited.end(), 0); ////위 2가지 방식으로 하면 vector로 visited 선언할 때는 안되더라구요. 배열로 선언한 것은 되는데.. cnt = 0; for (int i = 0; i < M; ++i) { for (int j = 0; j < M; ++j) { //cout << "debug i = " << i << " j = " << j << " c = " << c << "\n"; //cout << "debug vec[i][j] = " << vec[i][j] << " c = " << c << "\n"; if( (vec[i][j] > c) && (visited[i][j] != 1) ) { dfs(i, j, c); cnt++; } } } //cout << "-------cnt-----\n"; //cout << cnt << "\n"; //cout << "-------cnt-----\n"; ans = max(cnt, ans); } cout << ans;} 결론적으로, 질문을 간단히 드리면, array로 선언할 때는 memset으로 중간 초기화 작업을 할 수 있는데,vector로 사용할 때는 resize로 size 맞추면 그 다음에 초기화는 어떻게 진행해야 되는 건가요..ㅠ.ㅠ일일이 하나씩 해줘야 하는건가요?
-
미해결
스프링 핵심 원리 - 기본편 빈 스코프
request 스코프 강의를 듣던중 실습대로 따라 작성했으나 스프링 서버가 정상 실행되고 demo-log 매핑도 작동하지 않습니다. 혹시 몰라서 소스코드를 첨부 합니다. 이유를 알려주세요ㅜhttps://we.tl/t-vt386ZnUk5
-
미해결배달앱 클론코딩 [with React Native]
build.gradle, proguard-rules.pro 파일 수정 후 발생한 에러 로 어려움을 겪고 있습니다.
상황 안녕하세요. 제로초님! 'react-native-config 문제 해결하기' 강의 내용대로 build.gradle, proguard-rules.pro 파일을 수정하고 안드로이트 스튜디오에서 BuildConfig파일에 API_URL가 잘 뜨는 것까지 확인하고 npm run android를 입력했는데 메트로 서버에서 에러가 나타나고 emulator는 빈 화면만 보여주고 있습니다. 에러 메트로 서버 에러 내용 WARN The native module for Flipper seems unavailable. Please verify that react-native-flipper is installed as yarn dependency to your project and, for iOS, that pod install is run in the ios directory. ERROR TypeError: Restricted in strict mode, js engine: hermes ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter. A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter. A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermesemulator 코드 android\app\build.gradleapply plugin: "com.android.application" apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" import com.android.build.OutputFile import org.apache.tools.ant.taskdefs.condition.Os /** * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * and bundleReleaseJsAndAssets). * These basically call `react-native bundle` with the correct arguments during the Android build * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * bundle directly from the development server. Below you can see all the possible configurations * and their defaults. If you decide to add a configuration block, make sure to add it before the * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ * // the name of the generated asset file containing your JS bundle * bundleAssetName: "index.android.bundle", * * // the entry file for bundle generation. If none specified and * // "index.android.js" exists, it will be used. Otherwise "index.js" is * // default. Can be overridden with ENTRY_FILE environment variable. * entryFile: "index.android.js", * * // https://reactnative.dev/docs/performance#enable-the-ram-format * bundleCommand: "ram-bundle", * * // whether to bundle JS and assets in debug mode * bundleInDebug: false, * * // whether to bundle JS and assets in release mode * bundleInRelease: true, * * // whether to bundle JS and assets in another build variant (if configured). * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants * // The configuration property can be in the following formats * // 'bundleIn${productFlavor}${buildType}' * // 'bundleIn${buildType}' * // bundleInFreeDebug: true, * // bundleInPaidRelease: true, * // bundleInBeta: true, * * // whether to disable dev mode in custom build variants (by default only disabled in release) * // for example: to disable dev mode in the staging build type (if configured) * devDisabledInStaging: true, * // The configuration property can be in the following formats * // 'devDisabledIn${productFlavor}${buildType}' * // 'devDisabledIn${buildType}' * * // the root of your project, i.e. where "package.json" lives * root: "../../", * * // where to put the JS bundle asset in debug mode * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", * * // where to put the JS bundle asset in release mode * jsBundleDirRelease: "$buildDir/intermediates/assets/release", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in debug mode * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in release mode * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", * * // by default the gradle tasks are skipped if none of the JS files or assets change; this means * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to * // date; if you have any other folders that you want to ignore for performance reasons (gradle * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ * // for example, you might want to remove it from here. * inputExcludes: ["android/**", "ios/**"], * * // override which node gets called and with what additional arguments * nodeExecutableAndArgs: ["node"], * * // supply additional arguments to the packager * extraPackagerArgs: [] * ] */ project.ext.react = [ enableHermes: true, // clean and rebuild if changing ] apply from: "../../node_modules/react-native/react.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore. * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc:+' /** * Whether to enable the Hermes VM. * * This should be set on project.ext.react and that value will be read here. If it is not set * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode * and the benefits of using Hermes will therefore be sharply reduced. */ def enableHermes = project.ext.react.get("enableHermes", false); /** * Architectures to build native code for. */ def reactNativeArchitectures() { def value = project.getProperties().get("reactNativeArchitectures") return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } android { ndkVersion rootProject.ext.ndkVersion compileSdkVersion rootProject.ext.compileSdkVersion defaultConfig { applicationId "com.fooddeliveryapp" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() resValue "string", "build_config_package", "com.fooddeliveryapp" if (isNewArchitectureEnabled()) { // We configure the CMake build only if you decide to opt-in for the New Architecture. externalNativeBuild { cmake { arguments "-DPROJECT_BUILD_DIR=$buildDir", "-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid", "-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build", "-DNODE_MODULES_DIR=$rootDir/../node_modules", "-DANDROID_STL=c++_shared" } } if (!enableSeparateBuildPerCPUArchitecture) { ndk { abiFilters (*reactNativeArchitectures()) } } } } if (isNewArchitectureEnabled()) { // We configure the NDK build only if you decide to opt-in for the New Architecture. externalNativeBuild { cmake { path "$projectDir/src/main/jni/CMakeLists.txt" } } def reactAndroidProjectDir = project(':ReactAndroid').projectDir def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) { dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck") from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") into("$buildDir/react-ndk/exported") } def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) { dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck") from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") into("$buildDir/react-ndk/exported") } afterEvaluate { // If you wish to add a custom TurboModule or component locally, // you should uncomment this line. // preBuild.dependsOn("generateCodegenArtifactsFromSchema") preDebugBuild.dependsOn(packageReactNdkDebugLibs) preReleaseBuild.dependsOn(packageReactNdkReleaseLibs) // Due to a bug inside AGP, we have to explicitly set a dependency // between configureCMakeDebug* tasks and the preBuild tasks. // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732 configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild) configureCMakeDebug.dependsOn(preDebugBuild) reactNativeArchitectures().each { architecture -> tasks.findByName("configureCMakeDebug[${architecture}]")?.configure { dependsOn("preDebugBuild") } tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure { dependsOn("preReleaseBuild") } } } } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include (*reactNativeArchitectures()) } } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } } buildTypes { debug { signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // https://developer.android.com/studio/build/configure-apk-splits.html // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = defaultConfig.versionCode * 1000 + versionCodes.get(abi) } } } } dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" // From node_modules implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { exclude group:'com.facebook.fbjni' } debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' exclude group:'com.squareup.okhttp3', module:'okhttp' } debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { exclude group:'com.facebook.flipper' } if (enableHermes) { //noinspection GradleDynamicVersion implementation("com.facebook.react:hermes-engine:+") { // From node_modules exclude group:'com.facebook.fbjni' } } else { implementation jscFlavor } } if (isNewArchitectureEnabled()) { // If new architecture is enabled, we let you build RN from source // Otherwise we fallback to a prebuilt .aar bundled in the NPM package. // This will be applied to all the imported transtitive dependency. configurations.all { resolutionStrategy.dependencySubstitution { substitute(module("com.facebook.react:react-native")) .using(project(":ReactAndroid")) .because("On New Architecture we're building React Native from source") substitute(module("com.facebook.react:hermes-engine")) .using(project(":ReactAndroid:hermes-engine")) .because("On New Architecture we're building Hermes from source") } } } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.implementation into 'libs' } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) def isNewArchitectureEnabled() { // To opt-in for the New Architecture, you can either: // - Set `newArchEnabled` to true inside the `gradle.properties` file // - Invoke gradle with `-newArchEnabled=true` // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true` return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" } android\app\proguard-rules.pro# Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles # directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: -keep class com.fooddeliveryapp.BuildConfig { *; } Android Studio (BuildConfig에 public static final String API_URL 생성됨)src/pages/SignUp.tsximport React, {useCallback, useRef, useState} from 'react'; import { ActivityIndicator, Alert, Platform, Pressable, StyleSheet, Text, TextInput, View, } from 'react-native'; import {NativeStackScreenProps} from '@react-navigation/native-stack'; import {RootStackParamList} from '../../AppInner'; import DismissKeyboardView from '../components/DissmissKeyboardView'; import axios, {AxiosError} from 'axios'; import Config from 'react-native-config'; type SignUpScreenProps = NativeStackScreenProps<RootStackParamList, 'SignUp'>; function SignUp({navigation}: SignUpScreenProps) { const [loading, setLoading] = useState(false); const [email, setEmail] = useState(''); const [name, setName] = useState(''); const [password, setPassword] = useState(''); const emailRef = useRef<TextInput | null>(null); const nameRef = useRef<TextInput | null>(null); const passwordRef = useRef<TextInput | null>(null); const onChangeEmail = useCallback(text => { setEmail(text.trim()); // 스페이스바 입력못하게 미리 방지 }, []); const onChangeName = useCallback(text => { setName(text.trim()); }, []); const onChangePassword = useCallback(text => { setPassword(text.trim()); }, []); const onSubmit = useCallback(async () => { // 로딩 중일 때 회원가입 버튼 또 누르면 return해서 막기 if (loading) { return; } if (!email || !email.trim()) { return Alert.alert('알림', '이메일을 입력해주세요.'); } if (!name || !name.trim()) { return Alert.alert('알림', '이름을 입력해주세요.'); } if (!password || !password.trim()) { return Alert.alert('알림', '비밀번호를 입력해주세요.'); } if ( !/^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/.test( email, ) ) { return Alert.alert('알림', '올바른 이메일 주소가 아닙니다.'); } if (!/^(?=.*[A-Za-z])(?=.*[0-9])(?=.*[$@^!%*#?&]).{8,50}$/.test(password)) { return Alert.alert( '알림', '비밀번호는 영문,숫자,특수문자($@^!%*#?&)를 모두 포함하여 8자 이상 입력해야합니다.', ); } console.log(email, name, password); // 서버에 요청하기 try { // 로딩 상태 setLoading(true); console.log(Config.API_URL); const response = await axios.post(`${Config.API_URL}/user`, { email, name, password, }); console.log(response); Alert.alert('알림', '회원가입되었습니다'); } catch (error) { // 네트워크 에러 타입 지정 // const errorResponse = (error as AxiosError).response; console.error(error); // if (errorResponse) { // Alert.alert('알림', errorResponse.data.message); // } } finally { // 성공하든 실패하든 로딩 상태 변경 setLoading(false); } Alert.alert('알림', '회원가입 되었습니다.'); }, [email, name, password]); const canGoNext = email && name && password; return ( <DismissKeyboardView> <View style={styles.inputWrapper}> <Text style={styles.label}>이메일</Text> <TextInput style={styles.textInput} onChangeText={onChangeEmail} placeholder="이메일을 입력해주세요" placeholderTextColor="#666" textContentType="emailAddress" value={email} returnKeyType="next" clearButtonMode="while-editing" keyboardType="email-address" ref={emailRef} onSubmitEditing={() => nameRef.current?.focus()} blurOnSubmit={false} /> </View> <View style={styles.inputWrapper}> <Text style={styles.label}>이름</Text> <TextInput style={styles.textInput} placeholder="이름을 입력해주세요." placeholderTextColor="#666" onChangeText={onChangeName} value={name} textContentType="name" returnKeyType="next" clearButtonMode="while-editing" ref={nameRef} onSubmitEditing={() => passwordRef.current?.focus()} blurOnSubmit={false} /> </View> <View style={styles.inputWrapper}> <Text style={styles.label}>비밀번호</Text> <TextInput style={styles.textInput} placeholder="비밀번호를 입력해주세요(영문,숫자,특수문자)" placeholderTextColor="#666" onChangeText={onChangePassword} value={password} keyboardType={Platform.OS === 'android' ? 'default' : 'ascii-capable'} textContentType="password" secureTextEntry returnKeyType="send" clearButtonMode="while-editing" ref={passwordRef} onSubmitEditing={onSubmit} /> </View> <View style={styles.buttonZone}> <Pressable style={ canGoNext ? StyleSheet.compose(styles.loginButton, styles.loginButtonActive) : styles.loginButton } // 로딩 중일 때는 회원가입 버튼 클릭못하게 막기 disabled={!canGoNext || loading} onPress={onSubmit}> {/* 로딩 중일 때, indicator 보여주기 */} {loading ? ( <ActivityIndicator color="white" /> ) : ( <Text style={styles.loginButtonText}>회원가입</Text> )} </Pressable> </View> </DismissKeyboardView> ); } const styles = StyleSheet.create({ textInput: { padding: 5, borderBottomWidth: StyleSheet.hairlineWidth, }, inputWrapper: { padding: 20, }, label: { fontWeight: 'bold', fontSize: 16, marginBottom: 20, }, buttonZone: { alignItems: 'center', }, loginButton: { backgroundColor: 'gray', paddingHorizontal: 20, paddingVertical: 10, borderRadius: 5, marginBottom: 10, }, loginButtonActive: { backgroundColor: 'blue', }, loginButtonText: { color: 'white', fontSize: 16, }, }); export default SignUp; .envAPI_URL=http://10.0.2.2:3105 에러 해결을 위해 시도해본 것emulator 삭제 및 새로 생성 - 효과 x build.gradle, proguard-rules.pro 파일의 내용 원상복귀 - 효과 x 에러 내용 중 일부(Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication()) 구글링하여 얻은 정보로 npm start --reset-cache 입력 - 효과 x vscode 포함 모든 프로그램 종료 후 재실행 - 효과 x 어떻게 해결해야할지 모르겠습니다..!