본문 바로가기
React-Native

리액트네이티브(React-Native)에 애드몹 모듈을 설치하고, 컴파일 시 오류 해결법

by Dokon Jang 2018. 11. 23.
반응형

리액트네이티브(React-Native)에 애드몹 모듈을 설치하고, 안드로이드로 컴파일 시 아래와 같은 오류가 발생합니다.

해결 방법은 리액트네이티브 프로젝트 폴더 > android > build.gradle 파일을 수정해서 처리 했습니다.


[오류]

* What went wrong:

A problem occurred configuring project ':app'.

> Could not resolve all dependencies for configuration ':app:_debugApk'.

   > A problem occurred configuring project ':react-native-admob'.

      > Could not resolve all dependencies for configuration ':react-native-admob:_debugPublishCopy'.

         > Could not find com.google.android.gms:play-services-ads-lite:12.0.1.

           Searched in the following locations:

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar

               file:/D:/temp/ProjectName/android/sdk-manager/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.pom

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar

               file:/D:/temp/ProjectName/android/sdk-manager/com/google/android/gms/play-services-ads-lite/12.0.1/play-services-ads-lite-12.0.1.aar

           Required by:

               ProjectName:react-native-admob:unspecified > com.google.android.gms:play-services-ads:12.0.1

         > Could not find com.google.android.gms:play-services-basement:12.0.1.

           Searched in the following locations:

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar

               file:/D:/temp/ProjectName/android/sdk-manager/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.pom

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar

               file:/D:/temp/ProjectName/android/sdk-manager/com/google/android/gms/play-services-basement/12.0.1/play-services-basement-12.0.1.aar

           Required by:

               ProjectName:react-native-admob:unspecified > com.google.android.gms:play-services-ads:12.0.1

         > Could not find com.google.android.gms:play-services-gass:12.0.1.

           Searched in the following locations:

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar

               file:/D:/temp/ProjectName/android/sdk-manager/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.pom

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar

               file:/D:/temp/ProjectName/android/sdk-manager/com/google/android/gms/play-services-gass/12.0.1/play-services-gass-12.0.1.aar

           Required by:

               ProjectName:react-native-admob:unspecified > com.google.android.gms:play-services-ads:12.0.1

         > Could not find com.google.android.gms:play-services-ads-license:12.0.1.

           Searched in the following locations:

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar

               file:/D:/temp/ProjectName/android/sdk-manager/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.pom

               file:/C:/Users/docko/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar

               file:/D:/temp/ProjectName/android/sdk-manager/com/google/android/gms/play-services-ads-license/12.0.1/play-services-ads-license-12.0.1.aar

           Required by:

               ProjectName:react-native-admob:unspecified > com.google.android.gms:play-services-ads:12.0.1



[해결]

// 아래의 스크립트에 maven { url "https://maven.google.com" }를 추가

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


buildscript {

    repositories {

        maven { url "https://maven.google.com" }

        jcenter()

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:2.2.3'


        // NOTE: Do not place your application dependencies here; they belong

        // in the individual module build.gradle files

    }

}


allprojects {

    repositories {

        mavenLocal()

        maven { url "https://maven.google.com" }

        jcenter()

        maven {

            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm

            url "$rootDir/../node_modules/react-native/android"

        }

    }

}

반응형

댓글0