crossplatformkorea / react-native-kakao-login

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

android 빌드 시 두 가지 에러 발생 error: incompatible types, error: cannot find symbol #4

Closed byunghyunpark closed 6 years ago

byunghyunpark commented 6 years ago

readme 파일과 KakaoLoginExample 폴더를 참고해서 설치를 진행했습니다.

  1. 안드로이드 카카오 SDK 설치 후의 설정과 관련해서는 여기를 참고해주세요. 성공적으로 build가 되는 것을 확인하시면 아래를 진행하시면 됩니다.

그런데 위 단계까지 진행하면, 빌드 중 아래와 같은 에러가 발생합니다.

> Task :react-native-kakao-logins:compileDebugJavaWithJavac
/Users/pbh/project/react/luxlabUser/node_modules/react-native-kakao-logins/android/src/main/java/com/dooboolab/kakaologins/RNKakaoLoginsModule.java:37: error: cannot find symbol
import com.kakao.usermgmt.callback.MeV2ResponseCallback;
                                  ^
  symbol:   class MeV2ResponseCallback
  location: package com.kakao.usermgmt.callback
/Users/pbh/project/react/luxlabUser/node_modules/react-native-kakao-logins/android/src/main/java/com/dooboolab/kakaologins/RNKakaoLoginsModule.java:38: error: cannot find symbol
import com.kakao.usermgmt.response.MeV2Response;
                                  ^
  symbol:   class MeV2Response
  location: package com.kakao.usermgmt.response
/Users/pbh/project/react/luxlabUser/node_modules/react-native-kakao-logins/android/src/main/java/com/dooboolab/kakaologins/RNKakaoLoginsModule.java:125: error: incompatible types: View cannot be converted to ImageView
        ImageView imageView = convertView.findViewById(com.kakao.usermgmt.R.id.login_method_icon);
                                                      ^
/Users/pbh/project/react/luxlabUser/node_modules/react-native-kakao-logins/android/src/main/java/com/dooboolab/kakaologins/RNKakaoLoginsModule.java:131: error: incompatible types: View cannot be converted to TextView
        TextView textView = convertView.findViewById(com.kakao.usermgmt.R.id.login_method_text);
                                                    ^
/Users/pbh/project/react/luxlabUser/node_modules/react-native-kakao-logins/android/src/main/java/com/dooboolab/kakaologins/RNKakaoLoginsModule.java:158: error: incompatible types: View cannot be converted to ListView
    ListView listView = dialog.findViewById(com.kakao.usermgmt.R.id.login_list_view);
                                           ^
/Users/pbh/project/react/luxlabUser/node_modules/react-native-kakao-logins/android/src/main/java/com/dooboolab/kakaologins/RNKakaoLoginsModule.java:171: error: incompatible types: View cannot be converted to Button
    Button closeButton = dialog.findViewById(com.kakao.usermgmt.R.id.login_close_button);
                                            ^
/Users/pbh/project/react/luxlabUser/node_modules/react-native-kakao-logins/android/src/main/java/com/dooboolab/kakaologins/RNKakaoLoginsModule.java:216: error: cannot find symbol
    UserManagement.getInstance().requestLogout(new LogoutResponseCallback() {
                  ^
  symbol:   method getInstance()
  location: class UserManagement
/Users/pbh/project/react/luxlabUser/node_modules/react-native-kakao-logins/android/src/main/java/com/dooboolab/kakaologins/RNKakaoLoginsModule.java:242: error: cannot find symbol
    UserManagement.getInstance().me(new MeV2ResponseCallback() {
                                        ^
  symbol:   class MeV2ResponseCallback
  location: class RNKakaoLoginsModule
/Users/pbh/project/react/luxlabUser/node_modules/react-native-kakao-logins/android/src/main/java/com/dooboolab/kakaologins/RNKakaoLoginsModule.java:242: error: cannot find symbol
    UserManagement.getInstance().me(new MeV2ResponseCallback() {
                  ^
  symbol:   method getInstance()
  location: class UserManagement
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
9 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-kakao-logins:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
hyochan commented 6 years ago

@byunghyunpark 이슈 대응이 늦어 죄송합니다. 혹시 RN 버전이랑 mobx? 같은걸 쓰시는지 여쭤봐도 될까요? Cannot find symbol오류는 최신 버전 RN(0.56)에서 자주 발생되는 문제입니다. 우선 저도 테스트하고 다시 오겠습니다.

byunghyunpark commented 6 years ago

@dooboolab 님 빠른 답변 감사합니다 ^^ ios는 정상 동작합니다. android만 이슈가 있네요 ㅠ

제 package.json 입니다.

{
    "name": "luxlabUser",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "firebase": "^5.0.4",
        "moment": "^2.20.1",
        "prop-types": "^15.6.0",
        "react": "^16.0.0-alpha.12",
        "react-addons-update": "^15.6.2",
        "react-moment": "^0.6.9",
        "react-native": "^0.48.4",
        "react-native-camera": "^1.1.4",
        "react-native-check-box": "^2.0.2",
        "react-native-communications": "^2.2.1",
        "react-native-device-info": "^0.13.0",
        "react-native-elements": "^0.18.5",
        "react-native-facebook-login": "^1.6.0",
        "react-native-fcm": "^10.0.3",
        "react-native-gifted-chat": "^0.4.3",
        "react-native-image-crop-picker": "^0.18.2",
        "react-native-image-picker": "^0.26.7",
        "react-native-image-zoom-viewer": "^2.0.20",
        "react-native-kakao-logins": "^0.1.4",
        "react-native-keyboard-aware-scroll-view": "^0.4.3",
        "react-native-keyboard-spacer": "^0.4.1",
        "react-native-maps": "^0.17.1",
        "react-native-modal": "^4.1.1",
        "react-native-modal-selector": "0.0.24",
        "react-native-permissions": "^1.0.6",
        "react-native-progress": "^3.4.0",
        "react-native-simple-radio-button": "^2.7.2",
        "react-native-snap-carousel": "^3.5.0",
        "react-native-splash-screen": "^3.0.6",
        "react-native-swiper": "^1.5.13",
        "react-native-vector-icons": "^4.5.0",
        "react-navigation": "^1.0.0-beta.27",
        "react-redux": "^5.0.6",
        "redux": "^3.7.2",
        "redux-persist": "^5.5.0",
        "redux-thunk": "^2.2.0"
    },
    "devDependencies": {
        "babel-jest": "21.2.0",
        "babel-preset-react-native": "4.0.0",
        "jest": "21.2.1",
        "react-test-renderer": "16.0.0"
    },
    "jest": {
        "preset": "react-native"
    },
    "build:ios": "react-native bundle --entry-file='index.ios.js' --bundle-output='./ios/luxlabUser/main.jsbundle' --dev=false --platform='ios' --assets-dest='./ios'"
}
byunghyunpark commented 6 years ago

@dooboolab 추가로 설치를 위해 제가 한 작업은 세가지 입니다.

  1. npm install react-native-kakao-logins --save
  2. android Manual installation
  3. android/build.gradle 파일에 아래 코드 추가
subprojects {
    repositories {
        mavenCentral()
        maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
    }
}

에러를 무시하고 이 후 Post intallation 문서에 따라 작업을 전부 진행해도 상기 에러는 계속 발생합니다..

hyochan commented 6 years ago

@byunghyunpark 이번에 react-native-cli가 업글되고 나서 react-native link 부문에서 어떤 부분이 꼬이는지 버전이 안맞는건지 저도 갑자기 빌드가 안되는 현상이 생겨서 급하게 수정은 했습니다.

  1. 우선 npm install --save react-native-kakao-logins@0.1.7을 받아주세요.
  2. 말씀하신 위 부분을 추가해주세요.
    subprojects {
    repositories {
        mavenCentral()
        maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
    }
    }
  3. manifest 파일에서 allowBackup을 true로 설정해주세요.
  4. react-native-kakao-logins build.gradle에서 버전을 맞춰주세요. 아래 파일은 참고용으로 첨부드립니다.

buildscript { repositories { jcenter() }

dependencies {
    classpath 'com.android.tools.build:gradle:1.3.1'
}

}

apply plugin: 'com.android.library'

android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" ndk { abiFilters "armeabi-v7a", "x86" } } }

repositories { mavenCentral() }

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

dependencies { compile 'com.facebook.react:react-native:+' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" compile group: project.KAKAO_SDK_GROUP, name: 'usermgmt', version: project.KAKAO_SDK_VERSION }



[Test.zip](https://github.com/react-native-seoul/react-native-kakao-logins/files/2175656/Test.zip)
위 test.zip파일은 안드로이드 빌드가 성공적으로 된 프로젝트 첨부파일입니다.
byunghyunpark commented 6 years ago

@dooboolab 답변 감사합니다:)

말씀하신대로 build.gradle 파일에서 아래 두 가지 버전을

제 프로젝트와 일치 시키니 빌드 성공합니다.

android { compileSdkVersion 26 buildToolsVersion "26.0.0-beta2"