EAS android build crash on camera launch - android

App crashes only with (internal) android build (not with expo, not with standalone internal ios build)
Permission request before launching the comp with the camera
=> const { status } = await Camera.requestCameraPermissionsAsync(); resp.
=> const { status } = await Camera.requestMicrophonePermissionsAsync();
if (status == 'granted') navigation.navigate(' .....
Also tried it within useEffect of the comp - no difference
App.json (extract)
...
"android": {
"googleServicesFile": "./google-services.json",
"adaptiveIcon": {
"foregroundImage": "./src/assets/",
"backgroundColor": "#FFFFFF"
},
"package": ,
"versionCode": 12,
"softwareKeyboardLayoutMode": "pan",
"permissions": ["CAMERA", "RECORD_AUDIO", "NOTIFICATION", "WRITE_SETTINGS", "VIBRATE", "READ_PHONE_STATE",
"READ_EXTERNAL_STORAGE", "WRITE_EXTERNAL_STORAGE", "ACCESS_FINE_LOCATION", "ACCESS_BACKGROUND_LOCATION"],
"useNextNotificationsApi": true
},
...
Environment
EAS CLI 0.45.1 environment info:
System:
OS: Windows 10 10.0.19043
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
Utilities:
Git: 2.33.0.
npmPackages:
expo: ^44.0.0 => 44.0.5
expo-updates: ~0.11.4 => 0.11.4
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-web: 0.17.1 => 0.17.1
Project workflow: managed
Expo CLI 5.0.3 environment info:
System:
OS: Windows 10 10.0.19043
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
Watchman: 20200730.120504.0 - C:\Users\herma\AppData\Local\watchman\watchman.EXE
IDEs:
Android Studio: Version 2020.3.0.0 AI-203.7717.56.2031.7621141
npmPackages:
#expo/metro-config: ^0.2.8 => 0.2.8
expo: ^44.0.0 => 44.0.5
react: 17.0.1 => 17.0.1
react-dom: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-web: 0.17.1 => 0.17.1
Expo Workflow: managed
Sentry Error Output:
NullPointerException
Attempt to invoke interface method 'expo.modules.interfaces.barcodescanner.BarCodeScannerInterface expo.modules.interfaces.barcodescanner.BarCodeScannerProviderInterface.createBarCodeDetectorWithContext(android.content.Context)' on a null object reference
Important to notice: I do NOT use the BarCodeScanner

Related

react-native android error: package does not exist

I am new to react-native and I have to do the support on an app.
I can’t compile it on Android. I get an error while building it either by command line or from the android studio.
My configuration :
$ react-native info
info Fetching system and libraries information...
(node:21418) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
OS: Linux 5.15 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 # 3.00GHz
Memory: 228.16 MB / 7.68 GB
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 14.21.2 - ~/.nvm/versions/node/v14.21.2/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v14.21.2/bin/yarn
npm: 6.14.17 - ~/.nvm/versions/node/v14.21.2/bin/npm
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 30, 33, 33
Build Tools: 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.1
System Images: android-30 | Google APIs Intel x86 Atom, android-33 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: AI-213.7172.25.2113.9123335
Languages:
Java: 11.0.17 - /lib/jvm/java-1.11.0-openjdk-amd64/bin/javac
npmPackages:
#react-native-community/cli: ^10.1.0 => 10.1.0
react: ^18.1.0 => 18.2.0
react-native: 0.70.6 => 0.70.6
npmGlobalPackages:
*react-native*: Not Found
The command line  :
react-native run-android --variant=stagingDebug --appId com.< app name>.staging
Error that I get :
> Task :app:compileStagingDebugJavaWithJavac FAILED
359 actionable tasks: 6 executed, 353 up-to-date
<myProject root path>/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:99: error: package com.< app name>.staging does not exist
new CodePush(com.< app name>.staging.BuildConfig.CODEPUSH_KEY, this.getApplication(), com.< app name>.staging.BuildConfig.DEBUG),
react-native.config.js :
module.exports = {
dependencies: {
// disable autolinking for these unsupported libraries
// #codepush
'react-native-code-push': {
platforms: {
android: {
packageImportPath: 'import com.microsoft.codepush.react.CodePush;',
packageInstance:
'new CodePush(BuildConfig.CODEPUSH_KEY, this.getApplication(), BuildConfig.DEBUG)',
},
},
},
},
};
I hope someone can help me!

Android Error while Syncing project with Gradle React Native

i just started using my new M1 mac , environment setup done completely . while trying to sync project with Gradle i am getting following error :
Null extracted folder for artifact: ResolvedArtifact(componentIdentifier=com.facebook.react:react-native:0.66.4, variantName=null
and here is my env info :
System:
OS: macOS 12.5
CPU: (10) arm64 Apple M1 Max
Memory: 26.88 GB / 64.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.6.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.16.0 - /opt/homebrew/bin/npm
Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.16 - /usr/bin/javac
npmPackages:
#react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.4 => 0.66.4
and when i run through npx react-native run-android i got the following error:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Failed to transform react-native-0.66.4.aar (com.facebook.react:react-native:0.66.4) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for ExtractAarTransform: /Users/username/project'sfolder/node_modules/react-native/android/com/facebook/react/react-native/0.66.4/react-native-0.66.4.aar.
> Unexpected end of ZLIB input stream

React Native Android crash with LayoutAnimationController.shouldAnimateLayout

My app crashes in the production mode on android devices. Basically it is happening on Android 10(Samsung, Xiaomi, Huawei, LGE).
Stacktrace
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewParent android.view.View.getParent()' on a null object reference
at com.facebook.react.uimanager.layoutanimation.LayoutAnimationController.shouldAnimateLayout (LayoutAnimationController.java:91)
at com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java:453)
atcom.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute(UIViewOperationQueue.java:206)
at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:792)
at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:903)
at com.facebook.react.uimanager.UIViewOperationQueue.access$2400(UIViewOperationQueue.java:43)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:963)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:997)
at android.view.Choreographer.doCallbacks(Choreographer.java:797)
at android.view.Choreographer.doFrame(Choreographer.java:728)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:984)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)
React Native version:
System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i5-6267U CPU # 2.90GHz
Memory: 405.76 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.13.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.5 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.7, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 28, 29
Build Tools: 28.0.3, 29.0.0, 29.0.2, 29.0.3
System Images: android-22 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6514223
Xcode: 11.7/11E801a - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_242-release - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
#react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.0 => 0.62.0
npmGlobalPackages:
*react-native*: Not Found
I have the file with animation vars:
import { LayoutAnimation, LayoutAnimationConfig } from 'react-native';
export const AnimationVars = {
layoutAnimation: {
keyboard,
expandCollapse: { ...LayoutAnimation.Presets.easeInEaseOut, duration: expandCollapseDuration } as LayoutAnimationConfig,
inputField: { ...LayoutAnimation.Presets.easeInEaseOut, duration: inputFieldDuration } as LayoutAnimationConfig,
dialogTransform: { ...LayoutAnimation.Presets.easeInEaseOut, duration: expandCollapseDuration } as LayoutAnimationConfig,
navBarTransform: { ...LayoutAnimation.Presets.easeInEaseOut, duration: navBarDuration } as LayoutAnimationConfig,
},
};
And after use the var in different places of my app, for example in TitleExpanding component in toggle method:
private _onToggle(nextValue: boolean, animate: boolean = true) {
const rotateValue = !nextValue ? 1 : 0;
if (animate) {
requestAnimationFrame(() => {
timing(this._rotateValue, {
toValue: rotateValue,
duration: AnimationVars.expandCollapseDuration,
easing: Easing.linear,
}).start();
});
LayoutAnimation.configureNext(AnimationVars.layoutAnimation.expandCollapse);
} else {
this._rotateValue.setValue(rotateValue);
}
this._toggle.toggle();
const preferencesKey = this.props.preferencesKey;
if (preferencesKey) {
this._preferences.set(preferencesKey, nextValue ? 'false' : 'true').then();
}
}
I think it is the similar issue https://github.com/facebook/react-native/issues/25832. Please let me know if somebody stuck with the same error.
I was running into a similar issue and it was revolving around me having a Modal with buttons that fired the LayoutAnimation. One solution I found was to wrap the LayoutAnimation.configureNext in a setImmediate such as
setImmediate(() => LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut));
This had the effect of allowing the Modal enough time to be removed before the action was performed.

React Native Error: RNHTMLtoPDF error: Could not create folder structure

Development Environment
System:
OS: macOS 10.15.4
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU # 2.20GHz
Memory: 248.71 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.2.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 13.4, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
Languages:
Java: 13.0.1 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
#react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
*react-native*: Not Found
I am not able to make PDF in ANDROID API LEVEL 29. It is working fine in API LEVEL 28.
So I downgraded RN version from 0.63.2 from 0.62.2 and Gradle 3.5.3 to 3.5.2
according to this issue https://github.com/christopherdro/react-native-html-to-pdf/issues/189
also followed https://github.com/christopherdro/react-native-html-to-pdf/issues/149
this too. It says Permission error so inside componentDidMount() I have added following line
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE)
But still no luck.
I am getting following error.
Possible Unhandled Promise Rejection (id: 0):
Error: RNHTMLtoPDF error: Could not create folder structure.
promiseMethodWrapper#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2214:45
createPDF$#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:136885:88
tryCatch#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26640:23
invoke#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26813:32
tryCatch#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26640:23
invoke#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26713:30
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26743:19
tryCallTwo#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28610:9
doResolve#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28774:25
Promise#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28633:14
callInvokeWithMethodAndArg#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26742:33
enqueue#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26747:157
async#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26764:69
createPDF#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:136851:42
requestReadPermission$#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:136835:33
tryCatch#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26640:23
invoke#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26813:32
tryCatch#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26640:23
invoke#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26713:30
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:26723:21
tryCallOne#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28601:16
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:28702:27
_callTimer#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:32141:17
_callImmediatesPass#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:32177:19
callImmediates#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:32395:33
callImmediates#[native code]
__callImmediates#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2719:35
http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2505:34
__guard#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2702:15
flushedQueue#http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false:2504:21
flushedQueue#[native code]
invokeCallbackAndReturnFlushedQueue#[native code]
This is library which I am using https://github.com/christopherdro/react-native-html-to-pdf
I found solution from this link
If you find out that your app is not able to make any file or folder you should add
android:requestLegacyExternalStorage="true" in your `<application>` in `AndroidManifest.xml`
for more details Official Link and Other StackOverflow Question Answsers
Remember: I am using React Native and only in Android API 29 and above I stuck in this issue.
I was also facing that problem, after some researching, I solve that problem,
"Directory name must be same as the directory(folder) present in you device, if you want to make custom directory then it may or may not work in you device because of the file structure or some native permission if custom directory name not work then you have to specify 'Documents' or 'Download' at directory option"
Note:
Example:
async createPDF() {
let options = {
html: '<h1>Export PDF</h1>',
fileName: 'MyPdf',
directory: 'Documents', //or Download
};
let file = await RNHTMLtoPDF.convert(options)
alert(file.filePath);
}

React Native Error: TypeError: null is not an object _RNGestureHandlerModule.default.Direction

I have tried many ways to fix this error but all attempts have failed.
FOR ANDROID NOT IOS.
_RNGestureHandlerModule.default.Direction
I was trying for android. I found bug react-native-gesture-handler buy I don't know how to fix it.
I am following this instruction step by step https://reactnavigation.org/docs/en/getting-started.html
I tried linking the react-native-gesture-handler manual. and also tried unlinked.
I made react-native.config.js with code
exports = {
dependencies: {
'react-native-gesture-handler': {
platforms: {
android: null,
ios: null,
},
},
},
};
I am using System:
OS: Linux 5.3 Arch Linux undefined
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU # 3.70GHz
Memory: 16.06 GB / 31.21 GB
Shell: 5.0.11 - /bin/bash
Binaries:
Node: 12.13.0 - /usr/bin/node
Yarn: 1.19.1 - /usr/bin/yarn
npm: 6.12.1 - /usr/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.4 => 0.61.4
npmGlobalPackages:
react-native-cli: 2.0.1
"react-navigation": "^2.18.2",
"react-navigation-stack": "^1.10.3"
FOR ANDROID NOT IOS.
_RNGestureHandlerModule.default.Direction I wrote about the bug react-native-gesture-handler Github
Just simply you should comment line :
// export { default as Directions } from './Directions';
in the your project -> node_modules -> react-native-gesture-handler -> GestureHandler.js
I think it hope help you
Please try with
Pod update
It's working for me

Categories

Resources