I've updated to react-native 0.59.9
in order to support 64bit APK creation - https://medium.com/@andriidrozdov/reactnative-and-android-64-bit-new-google-play-market-rules-what-to-do-584b067d6f1a:
"react": "16.8.3",
"react-native": "0.59.9",
But after running the app with react-native run-android
it throws a build exception:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find com.android.support:appcompat-v7:28.0.0.
Searched in the following locations:
file:/C:/Users/brian-varley/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/support/appcompat-v7/28.0.0/appcompat-v7-28.0.0.pom
When I search the give path for appcompat-v7-28.0.0. I see that 28.0.0
is missing and the latest I version I have is 26.0.0-alpha1
. There is a similar question here but the answers didn't resolve the missing appcompat lib in this react-native project: Failed to resolve: com.android.support:appcompat-v7:28.0
Question:
How can I install a missing appcompat-v7 library in a react-native project?
These are my app and project level build.gralde files showing the dependencies and repositories defined.
Project level 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"
}
}
}
App level build.gradle
:
apply plugin: "com.android.application"
import com.android.build.OutputFile
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 28
buildToolsVersion "28.0.1"
defaultConfig {
applicationId "com.simple-offset-pro"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86", "x86_64"
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "x86_64"
}
}
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, "x86_64":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 {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:28.0.0"
compile "com.facebook.react:react-native:+" // From node_modules
}
// 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'
}