gpt4 book ai didi

android - react-native运行Android构建错误-无法解决:com.android.support:appcompat-v7:26.0.2

转载 作者:行者123 更新时间:2023-12-03 05:39:22 25 4
gpt4 key购买 nike

我正在通过Android Studio运行react-native应用程序,并且由于android支持依赖关系而不断遇到构建错误。我已经通过Android Studio安装了必要的SDK平台和工具,但仍然遇到此错误。
Could not find com.android.support:support-v7:26.0.2.
最初,我使用的是27.0.3,但随后我注意到我的所有库都默认设置为26.0.2,如在构建过程中以下警告消息所述-The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (26.0.2) for Android Gradle Plugin 3.0.1.
Android SDK Build Tools 26.0.2 will be used.

我已经咨询了各种StackOverflow解决方案,并且每次构建都会失败。对我可能做错的事情有任何想法吗?

app / build.gradle

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.jast"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}

dependencies {
compile project(':react-native-fetch-blob')
compile project(':react-native-aws')
compile project(':react-native-image-picker')
compile project(':react-native-mail')
compile project(':react-native-rate')
compile project(':appcenter-crashes')
compile project(':appcenter-analytics')
compile project(':appcenter')
compile project(':react-native-fcm')
compile(project(':react-native-firebase')) {
transitive = false
}
compile project(':react-native-maps')
compile project(':react-native-linear-gradient')
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:26.0.2"
compile "com.android.support:support-v7:26.0.2"
compile "com.facebook.react:react-native:+" // From node_modules

}

最佳答案

检查代码中的以下条件。

  • 检查项目级别build.gradle中是否存在google()。如果不是,请确保jcenter()出现在google()上方。
  • 在应用程序级别build.gradle
  • 中检查 jcenter()是否具有与appcompat版本和sdkversion有关的gradle版本。

    关于android - react-native运行Android构建错误-无法解决:com.android.support:appcompat-v7:26.0.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54157090/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com