我有一个反应性原生应用程序,我无法构建,因为依赖关系是不可用的。查看全错误输出,或者这个片段:
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-admob'.
> Could not resolve all dependencies for configuration ':react-native-admob:_debugPublishCopy'.
> Could not find com.android.support:support-core-ui:25.2.0.
Required by:
TennisAce:react-native-admob:unspecified
TennisAce:react-native-admob:unspecified > com.facebook.react:react-native:0.42.3 > com.android.support:appcompat-v7:23.0.1 > com.android.support:support-v4:25.2.0
TennisAce:react-native-admob:unspecified > com.facebook.react:react-native:0.42.3 > com.android.support:appcompat-v7:23.0.1 > com.android.support:support-v4:25.2.0 > com.android.support:support-fragment:25.2.0在Android中,我尝试过几次带有Gradle文件的同步项目,但是没有安装依赖项。
我尝试过使缓存失效/重新启动之后,Gradle构建也会出现相同的错误
这是我的android/build.gradle文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
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"
}
}
}这是我的android/app/build.gradle文件
apply plugin: "com.android.application"
import com.android.build.OutputFile
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.tennisace"
minSdkVersion 16
targetSdkVersion 23
versionCode 5
versionName "1.1"
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"
signingConfig signingConfigs.release
}
}
// 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-admob')
compile project(':react-native-photo-view')
compile project(':react-native-share')
compile project(':react-native-linear-gradient')
compile project(':react-native-vector-icons')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.react:react-native:+'
// From node_modules
compile 'com.google.android.gms:play-services-base:+'
compile 'com.google.android.gms:play-services-ads:+'
compile project(':react-native-onesignal')
compile project(':react-native-billing')
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}发布于 2017-07-20 05:41:31
您能否尝试将google()添加到存储库中,如*之间所示
buildscript {
repositories {
jcenter()
**google()**
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
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"
}
}
}发布于 2017-07-29 06:55:44
从Android卸载并重新安装解决了此错误。
https://stackoverflow.com/questions/45205868
复制相似问题