所以我第一次尝试运行我的代码,然后按照网站上的说明执行每一步,在Windows 10计算机上进行设置。
我收到了一些错误,经过一些研究后,我发现Gradle文件需要更新到此,我不知道为什么。
// Top-level build file where you can add configuration options common to all sub-projects/modules.
android {
compileSdkVersion 17
buildToolsVersion '23.0.1'
}
dependencies {
compile files('app/libs/junit-4.12-JavaDoc.jar')
}
apply plugin: 'maven'
buildscript {
repositories {
jcenter()
}
dependencies {
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.parse.bolts:bolts-tasks:1.3.0'
compile 'com.parse:parse-android:1.11.0'
compile 'com.android.support:design:22.2.1'
compile 'com.android.support:design:25.3.1'
classpath 'com.android.tools.build:gradle:2.3.3'
compile files('app/libs/junit-4.12-JavaDoc.jar')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply plugin: 'maven'
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
但即使在更新后我也遇到了这个错误:
Build file 'C:\app\Practice\ReactCode\albums\android\build.gradle' line: 16
出了什么问题: 评估根项目'专辑时出现问题。
无法在类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的对象上找到参数[com.android.support:appcompat-v7:22.2.1]的方法compile()。
尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。
建立失败
总时间:1.191秒 无法在设备上安装应用程序,请阅读上面的错误以获取详细信息。 确保您正在运行Android模拟器或已连接设备 设置Android开发环境: https://facebook.github.io/react-native/docs/android-setup.html
我不明白为什么我会收到所有这些错误以及如何解决这些错误。每次我想使用react-native时,我是否必须进行这些更正?
请帮忙 谢谢!