facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.05k stars 24.19k forks source link

Issue : Touch broken (Android/Debug) #25153

Closed maxoux closed 5 years ago

maxoux commented 5 years ago

Hi everyone !

First, i'm sorry if it's not very clear, it's my first request and i'm not sure about the process about this kind of post, so if you have any recommendations to structure this post and make it more clear, feel free to tell me.

While developping an app for my office, the App suddenly had a weird bug in debug only. Any touch or scroll not responding, like a freeze :

Additionnal Informations :

Solutions and Test tried :

Sadly i'm not very skilled in the native part of android, so i'm not sure where to check and after few searchs i couldn't find any similar behaviors, so any tips or recommendations are welcomes.

Cordially,

Configuration :

  React Native Environment Info:
    System:
      OS: Linux 4.9 Debian GNU/Linux 9 (stretch) 9 (stretch)
      CPU: (6) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
      Memory: 490.10 MB / 9.54 GB
      Shell: 4.4.12 - /bin/bash
    Binaries:
      Node: 10.15.3 - /usr/local/bin/node
      Yarn: 1.15.2 - /usr/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
    SDKs:
      Android SDK:
        API Levels: 23, 25, 27, 28
        Build Tools: 27.0.3, 28.0.3
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.3 => 0.59.3 
    npmGlobalPackages:
      react-native-cli: 2.0.1

package.json :

  "name": "xxx",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "clean": "rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean --force",
    "clean:android": "cd android/ && ./gradlew clean && cd .. && react-native run-android",
    "newclear": "rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean --force && npm i",
    "test:watch": "jest --watch",
    "updateSnapshot": "jest --updateSnapshot",
    "coverage": "jest --coverage && open coverage/lcov-report/index.html || xdg-open coverage/lcov-report/index.html",
    "android:build": "cd android && ./gradlew assembleRelease",
    "android:install": "cd android && ./gradlew assembleRelease && ./gradlew installRelease",
    "android:hockeyapp": "cd android && ./gradlew assembleRelease && puck -submit=auto app/build/outputs/apk/app-release.apk",
    "android:devices": "$ANDROID_HOME/platform-tools/adb devices",
    "android:logcat": "$ANDROID_HOME/platform-tools/adb logcat *:S ReactNative:V ReactNativeJS:V",
    "android:shake": "$ANDROID_HOME/platform-tools/adb devices | grep '\\t' | awk '{print $1}' | sed 's/\\s//g' | xargs -I {} $ANDROID_HOME/platform-tools/adb -s {} shell input keyevent 82",
    "storybook": "storybook start -p 7007",
    "lint": "standard --verbose | snazzy",
    "lintdiff": "git diff --name-only --cached --relative | grep '\\.js$' | xargs standard | snazzy",
    "fixcode": "standard --fix",
    "git-hook": "npm run lint -s && npm run test -s"
  },
  "dependencies": {
    "apisauce": "^1.0.2",
    "appcenter": "1.13.0",
    "appcenter-analytics": "1.13.0",
    "appcenter-crashes": "1.13.0",
    "faker": "^4.1.0",
    "format-json": "^1.0.3",
    "identity-obj-proxy": "^3.0.0",
    "lodash": "^4.17.11",
    "matter-js": "^0.14.2",
    "moment": "^2.24.0",
    "prop-types": "^15.7.2",
    "querystringify": "2.1.0",
    "ramda": "^0.26.1",
    "react": "16.8.3",
    "react-moment-proptypes": "^1.6.0",
    "react-native": "0.59.3",
    "react-native-animatable": "^1.3.2",
    "react-native-canvas": "^0.1.32",
    "react-native-code-push": "^5.6.0",
    "react-native-config": "^0.11.7",
    "react-native-device-info": "^1.6.1",
    "react-native-elements": "^1.1.0",
    "react-native-fs": "^2.13.3",
    "react-native-game-engine": "^0.11.5",
    "react-native-gesture-handler": "^1.0.14",
    "react-native-i18n": "2.0.14",
    "react-native-linear-gradient": "^2.5.4",
    "react-native-open-maps": "^0.3.3",
    "react-native-progress": "^3.6.0",
    "react-native-shadow": "^1.2.2",
    "react-native-svg": "^9.4.0",
    "react-native-vector-icons": "6.1.0",
    "react-navigation": "^3.11.0",
    "react-navigation-redux-helpers": "^2.0.6",
    "react-redux": "^6.0.0",
    "redux": "^4.0.0",
    "redux-persist": "^5.10.0",
    "redux-saga": "^1.0.0",
    "reduxsauce": "1.0.1",
    "seamless-immutable": "^7.1.4"
  },
  "devDependencies": {
    "@babel/core": "^7.4.4",
    "@babel/runtime": "^7.4.4",
    "@storybook/addon-storyshots": "^4.1.11",
    "@storybook/addons": "^4.1.11",
    "@storybook/channels": "^4.1.11",
    "@storybook/react-native": "^4.1.11",
    "@types/faker": "^4.1.5",
    "@types/jest": "^24.0.13",
    "@types/react": "^16.8.17",
    "@types/react-native": "^0.57.55",
    "@types/react-test-renderer": "^16.8.1",
    "babel-core": "6.26.3",
    "babel-eslint": "7.1.1",
    "babel-jest": "^24.8.0",
    "babel-plugin-ignite-ignore-reactotron": "^0.3.0",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react-native": "^4.0.1",
    "enzyme": "^3.2.0",
    "enzyme-adapter-react-16": "^1.1.0",
    "ignite-andross": "^4.0.2",
    "ignite-animatable": "1.0.2",
    "ignite-dev-screens": "2.4.5",
    "ignite-i18n": "1.2.0",
    "ignite-redux-persist": "1.1.2",
    "ignite-standard": "1.0.0",
    "ignite-vector-icons": "1.1.1",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.54.0",
    "mockery": "^2.1.0",
    "react-devtools-core": "3.6.0",
    "react-dom": "16.7.0",
    "react-native-typescript-transformer": "^1.2.12",
    "react-test-renderer": "16.8.3",
    "reactotron-react-native": "^2.1.0",
    "reactotron-redux": "^2.1.0",
    "reactotron-redux-saga": "^3.0.0",
    "snazzy": "^8.0.0",
    "standard": "10.0.2",
    "typescript": "^3.4.5"
  },
  "jest": {
    "preset": "react-native",
    "testMatch": [
      "<rootDir>/Tests/**/*.js",
      "**/?(*.)(spec|test).js?(x)"
    ],
    "testPathIgnorePatterns": [
      "/node_modules/",
      "<rootDir>/Tests/Setup.js"
    ],
    "moduleNameMapper": {
      "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "identity-obj-proxy"
    },
    "transform": {
      "^.+\\.(js)$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
    },
    "setupFiles": [
      "<rootDir>/Tests/Setup"
    ]
  },
  "config": {},
  "standard": {
    "parser": "babel-eslint",
    "globals": [
      "describe",
      "test",
      "jest",
      "expect",
      "fetch",
      "navigator",
      "__DEV__",
      "XMLHttpRequest",
      "FormData",
      "React$Element"
    ]
  },
  "rnpm": {
    "assets": [
      "./assets/fonts"
    ]
  }
}

build.gradle :


import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

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

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.xxx"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 7
        versionName "0.6"
    }
    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
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    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, "arm64-v8a": 3, "x86_64": 4]
            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(':react-native-fs')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-svg')
    implementation project(':react-native-code-push')
    implementation project(':react-native-config')
    implementation project(':appcenter-crashes')
    implementation project(':appcenter-analytics')
    implementation project(':appcenter')
    implementation project(':react-native-device-info')
    implementation project(':react-native-i18n')
    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}"
    implementation "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'
}
react-native-bot commented 5 years ago

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

👉 Click here if you want to report a reproducible bug or regression in React Native.

vkrenta commented 4 years ago

same bug with windows 10 and react-native v0.62

AricWu commented 4 years ago

same bug with macOs and react-native v0.62.2, timer and touch event not working

weinixuehao commented 4 years ago

@AricWu Me too! Do you have a solution for the issue?

fabOnReact commented 4 years ago

duplicate of https://github.com/facebook/react-native/issues/28687

avinashlng1080 commented 4 years ago

me too