gpt4 book ai didi

android - 任务 ':app:preDebugBuild' react 失败,执行 native android

转载 作者:行者123 更新时间:2023-12-03 05:06:34 24 4
gpt4 key购买 nike

我正在尝试使用以下命令在android模拟器上运行我的react-native应用程序:

npm start
react-native link
react-native run-android

它失败了,我得到这个错误:
Execution failed for task ':app:preDebugBuild'.
> Android dependency 'androidx.slidingpanelayout:slidingpanelayout' has different version for the compile (1.0.0-rc01) and runtime (1.0.0) classpath. You should manually set the same version via DependencyResolution.

我试图删除node_modules和android / app / build文件夹并重复命令,但效果不佳

这是我的build.gradle(文件路径:
'someProject / android / app / build.gradle')文件如下所示:
apply plugin: "com.android.application"

import com.android.build.OutputFile

project.ext.react = [
entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-sentry/sentry.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "com.someProject"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a"
}
}
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, "arm64-v8a": 3]
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 {
implementation project(':rn-fetch-blob')
implementation project(':react-native-svg')
implementation project(':react-native-splash-screen')
implementation project(':react-native-sentry')
implementation project(':react-native-image-resizer')
implementation project(':react-native-image-picker')
implementation project(':react-native-i18n')
implementation project(':react-native-firebase')
implementation project(':react-native-device-info')
implementation project(':react-native-camera')
implementation project(':react-native-blur')
implementation project(':lottie-react-native')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}

task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}

最佳答案

尝试删除“\ android \ app \ build”文件夹,然后再次删除react-native run-android

关于android - 任务 ':app:preDebugBuild' react 失败,执行 native android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57270437/

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