I am working on react-native project.
After I update my modules by running 'npm install',
I cannot find class 'Pools' which located in 'android.support.v4.util' in 'react-native-gesture-handler'.
- Why Is this error occur?
- How can I fix this?
1.error (In case run "react-native run-android") -cmd
Task :react-native-gesture-handler:compileDebugJavaWithJavac FAILED
D:\weneepl\project_y-test2_t\project_y\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:3: error: cannot find symbol
import android.support.v4.util.Pools;
^
symbol: class Pools
location: package android.support.v4.util
D:\weneepl\project_y-test2_t\project_y\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:19: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerEvent> EVENTS_POOL =
^
D:\weneepl\project_y-test2_t\project_y\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:3: error: cannot find symbol
import android.support.v4.util.Pools;
^
symbol: class Pools
location: package android.support.v4.util
D:\weneepl\project_y-test2_t\project_y\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:18: error: package Pools does not exist
private static final Pools.SynchronizedPool<RNGestureHandlerStateChangeEvent> EVENTS_POOL =
^
D:\weneepl\project_y-test2_t\project_y\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerEvent.java:20: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
D:\weneepl\project_y-test2_t\project_y\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerStateChangeEvent.java:19: error: package Pools does not exist
new Pools.SynchronizedPool<>(TOUCH_EVENTS_POOL_SIZE);
^
Note:D:\weneepl\project_y-test2_t\project_y\node_modules\react-native-gesture-handler\android\src\main\java\com\swmansion\gesturehandler\react\RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
6 errors
2.React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
Memory: 7.59 GB / 15.96 GB
Binaries:
Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.5429.30.34.5452501
3.package.json
{
"name": "project_y",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native run-android",
"gradle-clean": "cd android & gradlew clean",
"start-root": "react-native run-android --root",
"test": "jest",
"bundle": "react-native bundle --platform android --dev false --entry-file
index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/",
"build": "cd android & gradlew assembleDebug"
},
"dependencies": {
"axios": "^0.18.0",
"moment": "^2.24.0",
"prop-types": "^15.7.2",
"react": "16.6.3",
"react-native": "0.58.5",
"react-native-android-open-settings": "^1.3.0",
"react-native-custom-checkbox": "^1.5.2",
"react-native-gesture-handler": "^1.0.16",
"react-native-grid-list": "^1.0.9",
"react-native-image-resizer": "^1.0.1",
"react-native-kakao-logins": "^1.3.6",
"react-native-linear-gradient": "^2.5.3",
"react-native-picker-select": "^6.0.0",
"react-native-shadow": "^1.2.2",
"react-native-super-grid": "^3.0.3",
"react-native-svg": "^9.2.4",
"react-native-vector-icons": "^6.3.0",
"react-native-webview": "^5.5.0",
"react-navigation": "^3.3.2",
"react-redux": "^6.0.1",
"redux": "^4.0.1"
},
"devDependencies": {
"babel-core": "7.0.0-bridge.0",
"babel-jest": "24.1.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.52.0",
"react-test-renderer": "16.6.3",
"redux-devtools": "^3.5.0"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./assets/fonts/",
"resources/fonts"
]
}
}
4.build.gradle(app/)
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.projecty.projecty"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 10
versionName "1.9"
}
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.all { variant ->
variant.outputs.each { output ->
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 'com.google.android.gms:play-services-base:12.0.0'
implementation 'com.android.installreferrer:installreferrer:1.0'
implementation 'com.igaworks.adbrix:abx-common-rm:+'
implementation project(':react-native-webview')
implementation project(':react-native-android-open-settings')
implementation project(':react-native-kakao-logins')
implementation project(':react-native-svg')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-vector-icons')
implementation project(':react-native-gesture-handler')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-
v7:${rootProject.ext.supportLibVersion}"
compile(name: 'IgawSSP_v2.0.6a', ext: 'aar')
repositories {
flatDir {
dirs 'libs'
}
}
implementation "com.facebook.react:react-native:+" // From node_modules
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
subprojects {
repositories {
mavenCentral()
maven { url
'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
}
}
5.build.gradle(android/)
buildscript {
ext {
buildToolsVersion = "28.0.2"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
flatDir {
dirs 'libs'
}
maven {
url 'https://dl.bintray.com/igaworks/AdbrixRmSDK'
}
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
mavenCentral()
maven {
url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/'
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.7'
distributionUrl = distributionUrl.replace("bin", "all")
}
I expect the complete of build project.