crossplatformkorea / react-native-kakao-login

react-native native module for Kakao sign in.
MIT License
364 stars 137 forks source link

expo에서의 android install 문제 #397

Closed roseline124 closed 7 months ago

roseline124 commented 9 months ago

Description

안드로이드에서 의존성 설치가 안되서 build가 실패하는 것 같습니다.

> expo run:android

(node:73249) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
› Building app...
Starting a Gradle Daemon (subsequent builds will be faster)
Configuration on demand is an incubating feature.

> Configure project :expo

Using expo modules
  - expo-constants (15.4.5)
  - expo-file-system (16.0.5)
  - expo-font (11.10.2)
  - expo-image (1.10.6)
  - expo-keep-awake (12.8.2)
  - expo-modules-core$android-annotation-processor (1.11.8)
  - expo-modules-core (1.11.8)
  - expo-modules-core$android-annotation (1.11.8)
  - expo-splash-screen (0.26.4)
  - expo-system-ui (2.9.3)
  - expo-web-browser (12.8.2)

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.kakao.sdk:v2-user:2.11.2.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/com/kakao/sdk/v2-user/2.11.2/v2-user-2.11.2.pom
       - https://repo.maven.apache.org/maven2/com/kakao/sdk/v2-user/2.11.2/v2-user-2.11.2.pom
       - file:/Users/user/projects/myapp/node_modules/jsc-android/dist/com/kakao/sdk/v2-user/2.11.2/v2-user-2.11.2.pom
       - https://dl.google.com/dl/android/maven2/com/kakao/sdk/v2-user/2.11.2/v2-user-2.11.2.pom
       - https://www.jitpack.io/com/kakao/sdk/v2-user/2.11.2/v2-user-2.11.2.pom
       - file:/Users/user/projects/myapp/node_modules/react-native/android/com/kakao/sdk/v2-user/2.11.2/v2-user-2.11.2.pom
     Required by:
         project :app > project :react-native-seoul_kakao-login
   > Could not find com.kakao.sdk:v2-talk:2.11.2.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/com/kakao/sdk/v2-talk/2.11.2/v2-talk-2.11.2.pom
       - https://repo.maven.apache.org/maven2/com/kakao/sdk/v2-talk/2.11.2/v2-talk-2.11.2.pom
       - file:/Users/user/projects/myapp/node_modules/jsc-android/dist/com/kakao/sdk/v2-talk/2.11.2/v2-talk-2.11.2.pom
       - https://dl.google.com/dl/android/maven2/com/kakao/sdk/v2-talk/2.11.2/v2-talk-2.11.2.pom
       - https://www.jitpack.io/com/kakao/sdk/v2-talk/2.11.2/v2-talk-2.11.2.pom
       - file:/Users/user/projects/myapp/node_modules/react-native/android/com/kakao/sdk/v2-talk/2.11.2/v2-talk-2.11.2.pom
     Required by:
         project :app > project :react-native-seoul_kakao-login
   > Could not find com.kakao.sdk:v2-story:2.11.2.
     Searched in the following locations:
       - https://oss.sonatype.org/content/repositories/snapshots/com/kakao/sdk/v2-story/2.11.2/v2-story-2.11.2.pom
       - https://repo.maven.apache.org/maven2/com/kakao/sdk/v2-story/2.11.2/v2-story-2.11.2.pom
       - file:/Users/user/projects/myapp/node_modules/jsc-android/dist/com/kakao/sdk/v2-story/2.11.2/v2-story-2.11.2.pom
       - https://dl.google.com/dl/android/maven2/com/kakao/sdk/v2-story/2.11.2/v2-story-2.11.2.pom
       - https://www.jitpack.io/com/kakao/sdk/v2-story/2.11.2/v2-story-2.11.2.pom
       - file:/Users/user/projects/myapp/node_modules/react-native/android/com/kakao/sdk/v2-story/2.11.2/v2-story-2.11.2.pom
     Required by:
         project :app > project :react-native-seoul_kakao-login

* 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 24s
5 actionable tasks: 5 up-to-date
Error: /Users/user/projects/myapp/android/gradlew exited with non-zero code: 1
Error: /Users/user/projects/myapp/android/gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/user/projects/myapp/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
    at Object.onceWrapper (node:events:634:26)
    at ChildProcess.emit (node:events:519:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)
    ...
    at Object.spawnAsync [as default] (/Users/user/projects/myapp/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
    at spawnGradleAsync (/Users/user/projects/myapp/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:72:46)
    at Object.assembleAsync (/Users/user/projects/myapp/node_modules/@expo/cli/build/src/start/platforms/android/gradle.js:52:18)
    at runAndroidAsync (/Users/user/projects/myapp/node_modules/@expo/cli/build/src/run/android/runAndroidAsync.js:36:24)

카카오 개발자 페이지에서 설정은 README에 나온 대로 모두 해두었습니다. 다만 README '설치' 부분에서 npm install 하는 부분밖에 안나와 있어서 android, ios에서의 설치는 어떻게 되는지 잘 모르겠습니다. autolinking이 된다는 게 native쪽에도 설치된다 이 말씀이시죠? 참고로 react-native 0.73.2 버전을 사용하고 있습니다.

build.gradle에 수동으로 아래와 같이 설치해줘서 다시 빌드했더니 이번엔 잘 되긴 합니다만 이게 올바른 방법인지 모르겠어서 여쭤봅니다. ㅠㅠ 앱 개발은 처음이라... 양해부탁드립니다.

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
        }
        // 이 부분 추가
        maven { url 'https://devrepo.kakao.com/nexus/content/groups/public/' }
        maven {
            // Android JSC is installed from npm
            url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist'))
        }

        google()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}

Steps to reproduce

  1. expo prebuild
  2. npm install @react-native-seoul/kakao-login
  3. npm run android(= expo run:android)

따로 eas build는 사용하고 있지 않습니다.

Snack or a link to a repository

-

React Native Kakao Login version

5.3.1

React Native version

0.73.2

Platforms

Android

JavaScript runtime

V8

Architecture

None

Build type

Debug mode

Device

Android emulator

Device model

pixel 3a

Acknowledgements

Yes

mym0404 commented 7 months ago

392 에서 expo plugin 옵션에서 kotlinVersion1.9.0으로 설정하면 해결된다고 논의된걸로 보이는데, 왜 저게 동작하게 된다는건지는 잘 모르겠고 제 로컬에서 expo 50을 가지고 실험해봤을 땐 동일하게 문제가 발생했습니다.

@choiuhana @coffsun @hyochan 이 문제가 1.9.0으로 해결된 이유를 설명해주실 수 있나요?

이 문제는 그냥 에러 로그에서 보이듯 maven repository에 여기에서 설명하고 있는 repository를 설정해주지 않아 kakao android sdk를 못찾는 문제로 보입니다.

따라서 expo-build-properties config plugin을 이용해서 이 repository를 추가해주시면 될겁니다.

npx expo install expo-build-properties
"plugins": [...
    [
    "expo-build-properties",
      {
       "android": {
        "extraMavenRepos": ["https://devrepo.kakao.com/nexus/content/groups/public/"]
      }
    }
    ],
    ...
],
diceros-soojungkim commented 4 months ago

잘되다가 갑자기 빌드가 안되는데... eas 의 문제일지 또 kotlinVersion을 올려줘야하는건지 모르겠네요. 위와 같은 설정은 이미 다 되어있는 상태입니다.