在运行此命令时: -react-native运行android 我遇到了这个错误:
我已验证要安装sdk工具(26.0.1,26.0.2、23.0.1和23.0.2)
我的gradle文件包含:
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.audioexample"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
dependencies {
compile project(':react-native-sound')
compile project(':react-native-audio')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:26.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
答案 0 :(得分:1)
我有同样的问题。
在android gradle文件中,您需要指定以下内容
compileSdkVersion 26
buildToolsVersion "26.0.1"
,然后找到此文本编译"com.android.support:appcompat-v7"
并确保其显示编译"com.android.support:appcompat-v7:26.0.1"
在您的build.gradle文件中,添加Maven网址'https://maven.google'应该如下所示
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url 'https://maven.google.com'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
} }
答案 1 :(得分:0)
在您的build.gradle文件中,添加Maven网址'https://maven.google.com'
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
url 'https://maven.google.com'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}