crossplatformkorea / react-native-kakao-login

react-native native module for Kakao sign in.
MIT License
350 stars 133 forks source link

Could not find com.kakao.sdk:usermgmt:1.7.0. #3

Closed byunghyunpark closed 6 years ago

byunghyunpark commented 6 years ago

패키지 설치 후 링크만 한 상태에서 react-native run-android 구동시 아래와 같은 에러가 발생합니다 매뉴얼로 링크 시켜도 동일한 에러가 발생합니다.

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.kakao.sdk:usermgmt:1.7.0.
  Searched in the following locations:
      file:/Users/pbh/Library/Android/sdk/extras/m2repository/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.pom
      file:/Users/pbh/Library/Android/sdk/extras/m2repository/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.jar
      file:/Users/pbh/Library/Android/sdk/extras/google/m2repository/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.pom
      file:/Users/pbh/Library/Android/sdk/extras/google/m2repository/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.jar
      file:/Users/pbh/Library/Android/sdk/extras/android/m2repository/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.pom
      file:/Users/pbh/Library/Android/sdk/extras/android/m2repository/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.jar
      file:/Users/pbh/.m2/repository/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.pom
      file:/Users/pbh/.m2/repository/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.jar
      https://jcenter.bintray.com/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.pom
      https://jcenter.bintray.com/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.jar
      https://dl.google.com/dl/android/maven2/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.pom
      https://dl.google.com/dl/android/maven2/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.jar
      file:/Users/pbh/project/react/luxlabUser_20180703/luxlabUser/node_modules/react-native/android/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.pom
      file:/Users/pbh/project/react/luxlabUser_20180703/luxlabUser/node_modules/react-native/android/com/kakao/sdk/usermgmt/1.7.0/usermgmt-1.7.0.jar
  Required by:
      project :app > project :react-native-kakao-logins

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 5s
19 actionable tasks: 1 executed, 18 up-to-date
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
byunghyunpark commented 6 years ago

제 android/build.gradle 코드입니다.

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
        classpath 'com.google.gms:google-services:3.1.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        google()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}
byunghyunpark commented 6 years ago

android/app/build.gradle 코드입니다.

apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * 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
 *   entryFile: "index.android.js",
 *
 *   // 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 = [
    entryFile: "index.js"
]

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

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0-beta2"

    defaultConfig {
        applicationId "com.einheads.luxlab2"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 49
        versionName "3.0.6"
        multiDexEnabled true //Add this
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
        vectorDrawables.useSupportLibrary = true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // 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:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile project(':react-native-kakao-logins')
    // google-service dependencies 에러 해결방법
    // https://medium.com/@suchydan/how-to-solve-google-play-services-version-collision-in-gradle-dependencies-ef086ae5c75f
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile project(':react-native-facebook-login')
    compile project(':react-native-image-crop-picker')
    compile project(':react-native-image-picker')
    compile project(':react-native-vector-icons')

    compile(project(':react-native-maps')){
        exclude group: 'com.google.android.gms'
    }
    compile (project(':react-native-fcm')){
        exclude group: "com.google.firebase" 
    }
    compile (project(':react-native-device-info')){
        exclude group: "com.google.android.gms" 
    }

    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
    compile ("com.google.android.gms:play-services-base:10.0.1") {
        force = true;
    }
    compile ("com.google.android.gms:play-services-maps:10.0.1") {
        force = true;
    }
    compile ("com.google.android.gms:play-services-gcm:10.0.1") {
        force = true;
    }
    compile ('com.google.firebase:firebase-core:10.0.1') {
        force = true;
    }
    compile ('com.google.firebase:firebase-messaging:10.0.1') {
        force = true;
    }
    compile project(':react-native-splash-screen')
}

// 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.compile
    into 'libs'
}

// custom font settings
project.ext.vectoricons = [
    iconFontNames: [ 'FontAwesome.ttf', 'Foundation.ttf', 'Ionicons.ttf', 'MaterialIcons.ttf' ] // Name of the font files you want to copy
]

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply plugin: 'com.google.gms.google-services'
byunghyunpark commented 6 years ago

src/main/java/[...]/MainApplication.java 코드입니다.

package com.einheads.luxlab2;

import com.dooboolab.kakaologins.RNKakaoLoginsPackage;
import android.app.Application;
import com.facebook.react.ReactApplication;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.evollu.react.fcm.FIRMessagingPackage;
import com.airbnb.android.react.maps.MapsPackage;
import com.reactnative.ivpusic.imagepicker.PickerPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.imagepicker.ImagePickerPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.facebook.FacebookSdk;
import com.magus.fblogin.FacebookLoginPackage;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new MapsPackage(),
            new SplashScreenReactPackage(),
            new RNDeviceInfo(),
            new FIRMessagingPackage(),
            new PickerPackage(),
            new VectorIconsPackage(),
            new ImagePickerPackage(),
            new FacebookLoginPackage(),
            new RNKakaoLoginsPackage()
      );
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}
byunghyunpark commented 6 years ago

마지막으로 android/settings.gradle 코드입니다.

rootProject.name = 'luxlabUser'
include ':react-native-kakao-logins'
project(':react-native-kakao-logins').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-kakao-logins/android')
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android')
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-facebook-login'
project(':react-native-facebook-login').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-facebook-login/android')
include ':react-native-fcm'
project(':react-native-fcm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fcm/android')

include ':app'
byunghyunpark commented 6 years ago

빌드 시 다른 에러가 발생하지만 본 이슈는 해결하였습니다. android/build.gradle 파일에 아래 코드를 추가 하지 않았습니다.

subprojects {
    repositories {
        mavenCentral()
        maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
    }
}
choijiho0021 commented 11 months ago

시간이 흘러 지금 Could not find com.kakao.sdk:usermgmt:1.7.0 해당에러가 뜨는 사람들에게 남깁니다.

https://devtalk.kakao.com/t/kakao-sdk-for-android-ios-v1-notice-end-of-support-for-kakao-sdk-for-android-and-ios-v1/125250 더이상 v1 버전은 지원하지 않습니다. kakao에서 maven에서 프로젝트를 내리고, 이에 대해 공지했어요.

기존에 라이브러리를 설치했던 사람은 빌드는 되지만 11월 유예기간이 끝나면 API 자체가 동작 안됩니다.

v2 버전으로 마이그레이션하세요.

저처럼 옛날 프로젝트 인수인계 받았는데, 빌드가 안되고 해당 에러가 뜨시는 분들은 참고하세요...