运行以下图像的android应用时出现错误:
对于package.json:
{
"name": "Training",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.4.1",
"react-native": "0.56.0"
},
"devDependencies": {
"babel-jest": "23.4.2",
"babel-preset-react-native": "5.0.2",
"jest": "23.4.2",
"react-test-renderer": "16.4.1"
},
"jest": {
"preset": "react-native"
}
}
和android/app/gradle.properties
:
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.facebook.react:react-native:+" // From node_modules
}
如何解决该问题?
答案 0 :(得分:0)
./gradlew androidDependencies
并检查输出结果,以反映您的构建实际使用的本机版本(0.56或0.52)答案 1 :(得分:0)
我通过以下方法解决了这个问题:
react-native run-android