ReactNative 本地编译

工程build.gradle文件

buildscript {
    repositories {
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter {
            url "http://jcenter.bintray.com/"
        }
        maven { url "https://jitpack.io" }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'de.undercouch:gradle-download-task:3.4.3'

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

allprojects {
    repositories {
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter {
            url "http://jcenter.bintray.com/"
        }
        maven { url "https://jitpack.io" }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }


    }
}

没有

classpath 'de.undercouch:gradle-download-task:3.4.3'

则ReactAdnroid中的

import de.undercouch.gradle.tasks.download.Download

报错

 unable to resolve class de.undercouch.gradle.tasks.download.Download
 maven {
            url 'https://maven.google.com/'
            name 'Google'
        }

要在

 jcenter {
            url "http://jcenter.bintray.com/"
        }

前面,否则报错

Error:Failed to resolve: com.android.support:support-core-ui:27.1.1

你可能感兴趣的:(ReactNative 本地编译)