Task :react-native-camera:compileGeneralDebugJavaWithJavac FAILED - android

My APP was running fine but while I tried a new installation it shows the error - Task :react-native-camera:compileGeneralDebugJavaWithJavac FAILED. Below code might help you to address the issue.
My package.json is given below:
{
"name": "app name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"#react-native-community/async-storage": "^1.7.1",
"axios": "^0.18.1",
"native-base": "^2.13.12",
"react": "16.8.3",
"react-native": "^0.62.2",
"react-native-animatable": "^1.3.2",
"react-native-camera": "^2.11.0",
"react-native-modalbox": "^1.7.1",
"react-native-qrcode-scanner": "^1.2.1",
"react-native-search-filter": "^0.1.4",
"react-native-vector-icons": "^6.5.0",
"react-native-webview": "5.8.1",
"react-navigation": "^2.18.3",
"url": "^0.11.0"
},
"devDependencies": {
"#babel/core": "7.4.5",
"#babel/runtime": "7.4.5",
"babel-jest": "^26.0.1",
"jest": "^26.0.1",
"metro-react-native-babel-preset": "^0.54.1",
"react-native-dotenv": "^0.2.0",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./assets/fonts/"
]
}
}
android/build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.0")
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
}
}
I have no clue on this error. Any help???

I think you have some linking problem.
I just faced same problem and solved it on React-Native v0.6,here's my solution:
JUST FOLLOWING THIS TUTORIAL
EXECUTE THIS `react-native run-android --no-jetifier
`

Related

I can not build React Native Project in Release Mode

React Native 0.70.1 Build in debug Mode, when i try to build in release mode, I get the below error.error message.
My package.json
{
"name": "xxxxxx",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-navigation/native": "^6.1.1",
"#react-navigation/native-stack": "^6.9.6",
"moment": "^2.29.4",
"react": "18.1.0",
"react-native": "0.70.6",
"react-native-image-picker": "^4.10.2",
"react-native-paper": "^5.0.1",
"react-native-raw-bottom-sheet": "^2.2.0",
"react-native-safe-area-context": "^4.5.0",
"react-native-screens": "^3.18.0",
"react-native-svg": "^13.7.0",
"react-native-vector-icons": "^9.2.0",
"rtn-fetch-module": "file:RTNFetchModule"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "0.72.3",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "18.1.0"
},
"jest": {
"preset": "react-native"
}
}
I am trying to build react-native in release mode.
Add multidex in /android/app/build.gradle file
android {
defaultConfig {
// ...
multiDexEnabled true // <-- ADD THIS in the defaultConfig section
}
// ...
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.1' // <-- ADD THIS DEPENDENCY
}
Then in android/app/src/main/java/.../MainApplication.java
// ... all your other imports here
import androidx.multidex.MultiDexApplication; // <-- ADD THIS IMPORT
// Your class definition needs `extends MultiDexApplication` like below
public class MainApplication extends MultiDexApplication implements ReactApplication {
Once added, rebuild your application: npx react-native run-android.

React native old project build failed

I am working in a old react native project. I am getting errors while running this app. How I can solve these errors. First time I am working in a old react native project. This app build in react native old version. I update this in to version. Please help me.
// My package.json ==>
"name": "unknown",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"flow": "flow --show-all-errors",
"flow start": "flow start",
"flow stop": "flow stop",
"flow status": "flow status",
"flow coverage": "flow coverage",
"eslint": "eslint",
"eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
},
"dependencies": {
"#react-native-community/cli-platform-android": "^9.1.0",
"babel-plugin-transform-remove-console": "6.9.4",
"braces": "^2.3.2",
"crypto-js": "4.1.1",
"currency-formatter": "1.5.9",
"d3": "7.3.0",
"d3-array": "3.1.1",
"d3-scale": "4.0.2",
"d3-shape": "3.1.0",
"moment": "^2.29.4",
"react": "^17.0.2",
"react-dom": "^18.2.0",
"react-native": "^0.69.5",
"react-native-appstore-version-checker": "3.0.0",
"react-native-device-info": "^10.1.1",
"react-native-dropdownalert": "4.5.1",
"react-native-elements": "3.4.2",
"react-native-fabric": "^0.5.2",
"react-native-fingerprint-scanner": "6.0.0",
"react-native-gesture-handler": "^2.6.0",
"react-native-keychain": "8.0.0",
"react-native-loading-spinner-overlay": "3.0.0",
"react-native-maps": "0.30.1",
"react-native-modal-datetime-picker": "13.0.1",
"react-native-pathjs-charts": "0.0.30",
"react-native-segmented-control-tab": "4.0.0",
"react-native-sentry": "0.43.2",
"react-native-simple-dialogs": "1.4.0",
"react-native-svg": "12.3.0",
"react-native-table-component": "1.2.2",
"react-native-vector-icons": "9.1.0",
"react-navigation": "4.4.4",
"react-redux": "7.2.6",
"realm": "10.13.0",
"redux": "4.1.2",
"redux-logger": "3.0.6",
"redux-thunk": "2.4.1"
},
"devDependencies": {
"#babel/core": "7.17.5",
"#babel/plugin-proposal-class-properties": "7.16.7",
"#babel/plugin-transform-runtime": "7.17.0",
"#babel/preset-env": "7.16.11",
"#babel/preset-react": "7.16.7",
"babel-cli": "6.26.0",
"babel-eslint": "10.1.0",
"babel-jest": "27.5.1",
"babel-plugin-module-resolver": "4.1.0",
"babel-preset-flow": "6.23.0",
"babel-preset-react-native": "2.1.0",
"eslint": "8.10.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "8.5.0",
"eslint-import-resolver-babel-module": "5.3.1",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-react": "7.29.3",
"flow-bin": "0.173.0",
"invariant": "2.2.4",
"jest": "27.5.1",
"metro-react-native-babel-preset": "0.69.0",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./assets/fonts/"
]
}
}
//project level gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
}
}
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"
}
}
}
//My gradle.app file ==>
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:'
}
}
apply plugin: "com.android.application"
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
When I try to run android app getting this below error->
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :realm.
Required by:
project :app
> No matching configuration of project :realm was found. The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.2.1' but:
- None of the consumable configurations have attributes.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s

Cannot read property 'transformFile' of undefined exception vue-native

I just wanted to try vue-native. However I get this error.
bundling failed: TypeError: Cannot read property 'transformFile' of undefined
Here is my package.json file
{
"name": "vueNativeDeneme",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.10",
"vue-native-core": "^0.1.4",
"vue-native-helper": "^0.1.4"
},
"devDependencies": {
"#babel/core": "7.6.4",
"#babel/runtime": "7.6.3",
"babel-jest": "24.9.0",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.56.3",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
How can I fix this?
Change your devDependencies:
"devDependencies":{
"#babel/core": "^7.0.0",
"#babel/preset-env": "^2.0.0-alpha.20",
"babel-preset-expo": "~8.0.0",
"vue-native-scripts": "0.0.16"
},
Problem solved.

react native released apk crush on launch

i get no errors when i compile the APK in release but after i install it it crashes instant on load. Here are my packages:
{
"name": "etwow_rent",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"#babel/runtime": "^7.1.2",
"bundle": "^2.1.0",
"haversine": "^1.1.0",
"react": "16.5.0",
"react-native": "^0.57.1",
"react-native-camera": "^1.3.0",
"react-native-maps": "^0.22.0",
"react-native-qrcode-scanner": "^1.1.0",
"react-navigation": "^2.18.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.48.0",
"react-native-bundle": "0.0.4",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}
maybe you forgot one of the steps for generating Signed APK ,Here is full Documentation of Generating Signed APK https://facebook.github.io/react-native/docs/signed-apk-android
You can go through it.

Babel error when running ./gradlew assembleRelease

I receive this error after running ./gradlew assembleRelease:
Plugin/Preset files are not allowed to export objects, only functions.
In C:\..\node_modules\babel-preset-expo\index.js
:app:bundleReleaseJsAndAssets FAILED
**FAILURE: Build failed with an exception.**
This is what I have in package.json file:
{
"name": "Mascota24",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-stage-0": "^6.24.1",
"react-test-renderer": "16.3.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "jest"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"#babel/preset-react": "^7.0.0-beta.53",
"babel-preset-env": "^1.7.0",
"babel-preset-expo": "^4.0.0",
"babel-preset-react": "^6.24.1",
"babel-preset-react-native": "^2.1.0",
"babel-preset-react-native-stage-0": "^1.0.1",
"react": "16.3.1",
"react-native": "^0.56.0",
"react-native-circle-checkbox": "^0.1.6",
"react-native-modal": "^6.4.0",
"react-native-phone-call": "^1.0.7",
"react-navigation": "^2.6.2",
"react-redux": "^5.0.7",
"redux-thunk": "^2.3.0"
}
}
And this is .babelrc file:
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
I've followed almost every post here related with this and none of them helped me :( Thanks for any help
Thanks to #ashutosh pandey for the help, I changed react-native version to:
"react-native": "^0.55"
Then I installed redux and could generate the .apk! :D

Categories

Resources