Reputation: 153
I have a react native app which I'm unable to build because dependencies are not available. View full error output, or this snippet:
> 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
Within Android Studio I've tried Sync project with Gradle files a few times, but the dependencies are not installed.
I've tried Invalidate caches/restart after which the Gradle build fails with the same errors
This is my android/build.gradle
file
// 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"
}
}
}
This is my android/app/build.gradle
file
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'
}
Upvotes: 1
Views: 3118
Reputation: 153
Uninstalling and reinstalling the Android Support Repository from the Android SDK Manager solved this error.
Upvotes: 0
Reputation: 2295
Can you try by adding the google() in the repositories like shown between the *
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"
}
}
}
Upvotes: 1