Compilation Errors in React Native Version 0.59.8 - Analytics & Push Kit

Viewed 120

Can Anyone tell me how to resolve these compilation errors. Facing these issues while integrating Analytics & Push Kit in React Native?

Could not determine the dependencies of task ':app:preDebugBuild'.

Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'. Could not resolve org.codehaus.mojo:animal-sniffer-annotations:1.17. Required by: project :app > Could not resolve org.codehaus.mojo:animal-sniffer-annotations:1.17. > Could not get resource 'http://developer.huawei.com/repo/org/codehaus/mojo/animal-sniffer-annotations/1.17/animal-sniffer-annotations-1.17.jar'. > Could not HEAD 'http://developer.huawei.com/repo/org/codehaus/mojo/animal-sniffer-annotations/1.17/animal-sniffer-annotations-1.17.jar'. > Read timed out Could not resolve org.codehaus.mojo:animal-sniffer-annotations:1.17. Required by: project :app > io.grpc:grpc-core:1.16.1 > Could not resolve org.codehaus.mojo:animal-sniffer-annotations:1.17. > Could not get resource 'http://developer.huawei.com/repo/org/codehaus/mojo/animal-sniffer-annotations/1.17/animal-sniffer-annotations-1.17.jar'. > Could not HEAD 'http://developer.huawei.com/repo/org/codehaus/mojo/animal-sniffer-annotations/1.17/animal-sniffer-annotations-1.17.jar'. > Read timed out

  > Could not resolve com.parse.bolts:bolts-applinks:1.4.0.
     > Could not get resource 'http://developer.huawei.com/repo/com/parse/bolts/bolts-applinks/1.4.0/bolts-applinks-1.4.0.jar'.
        > Could not HEAD 'http://developer.huawei.com/repo/com/parse/bolts/bolts-applinks/1.4.0/bolts-applinks-1.4.0.jar'.
           > Read timed out
2 Answers

this seems more likely to be an android/gradle configuration issue than a react-native issue. I do not have your source code so I cannot be sure, but I suspect you are missing something in the root level build.gradle

If you are migrating your app to HMS, I'd suggest you to cross reference your original project and simply add the line

maven {url 'http://developer.huawei.com/repo/'}

to the buildscript/repositories and allprojects/repositories blocks.

Following is a sample build.gradle file that can successfully resolve the problematic modules in your description:

buildscript {
ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 19
    compileSdkVersion = 28
    targetSdkVersion = 28
}
repositories {
    google()
    jcenter()
    maven {url 'http://developer.huawei.com/repo/'}
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.6.1'
    classpath 'com.huawei.agconnect:agcp:1.2.1.301'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}}

allprojects {
repositories {
    mavenLocal()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url("$rootDir/../node_modules/react-native/android")
    }
    maven {
        // Android JSC is installed from npm
        url("$rootDir/../node_modules/jsc-android/dist")
    }

    google()
    jcenter()
    maven { url 'https://www.jitpack.io' }
    maven {url 'http://developer.huawei.com/repo/'}
}}
Related