[macOS] run android 시 build failed 문제 (build.gradle.kts)
2970
작성자 없음
投稿した質問数 0
https://reactnative.dev/docs/environment-setup 보면서 기초 세팅 하고나서 프로젝트 생성 후 rpx react-native run-android 명령어를 치면 다음과 같이 빌드에러가 발생합니다.
[버전 정보]
macOS: Monterey 12.6.1, 2.7GHz 쿼드 코어 Intel Core i7
node-v: v18.12.1
watchman-v: 2022.11.07.00
java -version: openjdk version "11.0.17" 2022-10-18 LTS
ANDROID_SDK_ROOT 환경변수 설정 후 adb 명령어 입력: Android Debug Bridge version 1.0.41
공식문서에 나온대로 안드로이드 sdk 31 버전 다운로드하였습니다.
[에러 메시지]
~/Desktop/react-native-workspace/AweSomeProject 10:35:46
❯ npx react-native run-android
warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md
info JS server already running.
info Installing the app...
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/jihoon/Desktop/react-native-workspace/AweSomeProject/node_modules/react-native-gradle-plugin/build.gradle.kts' line: 12
* What went wrong:
Error resolving plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.6.10']
> Could not resolve all dependencies for configuration 'detachedConfiguration1'.
> Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(http://maven.anypoint.tv/repository/public)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.5.1/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/jihoon/Desktop/react-native-workspace/AweSomeProject/node_modules/react-native-gradle-plugin/build.gradle.kts' line: 12
* What went wrong:
Error resolving plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.6.10']
> Could not resolve all dependencies for configuration 'detachedConfiguration1'.
> Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(http://maven.anypoint.tv/repository/public)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.5.1/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
at makeError (/Users/jihoon/Desktop/react-native-workspace/AweSomeProject/node_modules/execa/index.js:174:9)
at /Users/jihoon/Desktop/react-native-workspace/AweSomeProject/node_modules/execa/index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (/Users/jihoon/Desktop/react-native-workspace/AweSomeProject/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:109:5)
at async Command.handleAction (/Users/jihoon/Desktop/react-native-workspace/AweSomeProject/node_modules/@react-native-community/cli/build/index.js:142:9)
info Run CLI with --verbose flag for more details.
[build.gradle.kts]
에러의 12번줄에 해당하는 코드 = kotlin("jvm") version "1.6.10"
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import org.gradle.api.internal.classpath.ModuleRegistry
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.configurationcache.extensions.serviceOf
plugins {
kotlin("jvm") version "1.6.10"
id("java-gradle-plugin")
}
repositories {
google()
mavenCentral()
}
gradlePlugin {
plugins {
create("react") {
id = "com.facebook.react"
implementationClass = "com.facebook.react.ReactPlugin"
}
}
}
group = "com.facebook.react"
dependencies {
implementation(gradleApi())
implementation("com.android.tools.build:gradle:7.2.1")
implementation("com.google.code.gson:gson:2.8.9")
implementation("com.google.guava:guava:31.0.1-jre")
implementation("com.squareup:javapoet:1.13.0")
testImplementation("junit:junit:4.13.2")
testRuntimeOnly(
files(
serviceOf<ModuleRegistry>()
.getModule("gradle-tooling-api-builders")
.classpath
.asFiles
.first()))
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions { jvmTarget = JavaVersion.VERSION_11.majorVersion }
}
tasks.withType<Test>().configureEach {
testLogging {
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
프로젝트를 생성하자마자 빌드에러가 떠서 에뮬레이터랑 연결할 수 없네요. 에러 메시지를 보면 maven 리포지토리 주소를 변경하라고 하는 것 같은데 어느 파일에 어느 위치에 변경해야할지 모르겠습니다.
깃헙주소: github.com/kkj0712/AweSomeProject
回答 2
0
답변 주셔서 감사합니다.
알고보니 맥북에서 특수한 maven repository를 바라보도록 설정되어 있었습니다. 제거하고 나니까 필요한 라이브러리들을 찾아서 빌드가 잘 되네요.
혹시나 저같은 에러 메시지가 뜨는 분들이 계시면 컴에 maven 주소가 따로 설정되어있는지 확인해보세요.
앱실행시 네이버맵 [401] 에러
0
955
2
스타일링 라이브러리
0
146
2
expo, cli 선택 중에 고민이 있습니다.
0
167
2
JDK 버전이 달라도 괜찮나요?
0
223
2
dimenstion usewindowdeminstion
0
120
3
[맥 전용]환경 설정하기 1편 & [맥 전용]환경 설정하기 2편의 영상이 안나옵니다.
0
209
1
jdk11 버전과 gradle 버전의 호환성 관련 질문드립니다.
0
398
2
강의 외 질문입니다!
0
157
2
react native랑 맞는 ui 라이브러리 어떤게 좋을까요?
0
1485
2
react native와 spring boot 연결
0
353
1
java가 아닌 .kt에서 code push 에러가 발생합니다.
0
210
2
flipper 239 에러가 발생합니다.
0
162
2
package.json에 /lib/panino.js 문제입니다.
0
464
2
window - mac 협업 과정 질문합니다
0
214
1
ios 빌드 중 RCTBridgeDelegate.h import 오류
0
289
2
ios 앱 빌드 중 hermesEnabled 관련 오류발생
0
238
2
Socket 연결시 질문 드립니다.!
0
151
2
wifi 환경에서 axios 통신이 로컬서버에서 안됩니다.
0
425
2
iOS render error 질문드립니다.
0
410
2
iOS 가상머신 오류
0
164
2
npc react init 명령어 실행시 발생되는 오류
0
220
1
nom start 시 오류
0
116
1
NextJS 기반으로 만들어서 웹뷰 React Native로 배포 가능한가요?
0
994
2
안드로이드 rn75 버전에 맞게 설정 중에 android13 다운로드에 대해서 막혔습니다!
0
183
2

