How to cache data on react-native-webview? - react-native

I want to create a simple webview app that shows the data of a website in an app. Is there a way to cache data in React Native Webview so that if there is no internet it shows cached screens.
I have tried react-native-offline-cache-webview but it does not work anymore. The app does not build and it shows the following error.
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/<user_name>/Projects/<app_name>/node_modules/react-native-offline-cache-webview/android/build.gradle' line: 43
* What went wrong:
A problem occurred evaluating project ':react-native-offline-cache-webview'.
> Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Is there any other way to cache web pages in webview ?

Related

React native - Error with Google mobile ads

I am build a mobile app with react native
"react-native": "^0.71.1",
"react-native-google-mobile-ads": "^9.1.1"
Without google-mobile-ads, app is working okay. But with this module, I get this error
023-02-07 23:05:06.067 xcodebuild[92292:1835009] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x7fa23ae8f960: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/sangnlee/Library/Developer/Xcode/DerivedData/aaa-csqwegbowuhmbrehpztorwqemvkb/SourcePackages/checkouts/swift-protobuf/Sources/protoc-gen-swift/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}
** BUILD FAILED **
The following build commands failed:
Ld /Users/aaa/Library/Developer/Xcode/DerivedData/aaa-csqwegbowuhmbrehpztorwqemvkb/Build/Products/Debug-iphonesimulator/aaa.app/aaa normal (in target 'aaa' from project 'aaa')
(1 failure)
Anyone knows how to solve this?

Error while specifying compileSdkversion in React Native Expo App

I have built a React Native app using Expo. Testing works fine in the emulator, but when I try to do an Android build I have errors. When I use the command npx expo run:android, I get the following error:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Script 'C:\Users\thish\OneDrive\Desktop\MottozPrinter\node_modules\expo-modules-autolinking\scripts\android\autolinking_implementation.gradle' line: 272
* What went wrong:
A problem occurred evaluating project ':expo'.
> A problem occurred configuring project ':expo-modules-core'.
> Failed to notify project evaluation listener.
> The filename, directory name, or volume label syntax is incorrect
> Could not get unknown property 'release' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':expo'.
> compileSdkVersion is not specified. Please add it to build.gradle
Here is my build.gradle android configuration:

React Native Error: react-native-sensor-manager:compileDebugJavaWithJavac FAILED

I'm trying to use the react-native-sensor-manager in order to get the user steps and count that. But the problem is after I installed this package and did all the configuration as in the documentation. I don't know what is wrong although a did all the steps correctly. I get this error when I run my project. So the build doesn't become compeleted and project is running.
Here is more about the error:
Task :react-native-sensor-manager:compileDebugJavaWithJavac FAILED
E:\Project\React Native Projects\walk_tacker2\node_modules\react-native-sensor-manager\android\src\main\java\com\sensormanager\AccelerometerRecord.java:9: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
* What went wrong:
Execution failed for task ':react-native-sensor-manager:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

FAILURE: Build failed with an exception in react native app

I have created my first project and try to run on my android device but it was an error like this.
FAILURE: Build failed with an exception.
*** What went wrong:
A problem occurred configuring project ':app'.
The SDK directory '/home/ford/Android/sdk' does not exist.**
Go to the android/ directory of your react-native project
Create a file called local.properties with this line:
sdk.dir = /Users/USERNAME/Library/Android/sdk or the android sdk directory where it is installed
Where USERNAME is your OSX username

Error: organization or project not found :app:bundleReleaseJsAndAssets FAILED

Unable to build the release Android APK after integrating the Sentry in my react native android application.I have been getting this error.
Error: organization or project not found
:app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* Where:
Script '/TF_ReactNative_Projects/Projects/MobilityOne/node_modules/react-native-sentry/sentry.gradle' line: 126
What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssetsdebugSentryUpload'.
Process 'command 'node_modules/sentry-cli-binary/bin/sentry-cli'' finished with non-zero exit value 1
Make sure you enter organization and project name. You can get your organization and project name at the sentry.io. For example:
https://sentry.io/abc/my-project
abc is organization
my-project is project
You can edit those info at ios/sentry.properties and android/sentry.properties
Then build again!
This happened to me because I added more projects to my organization after configuring Sentry in my React Native App.
I edited manually ios/sentry.properties and android/sentry.properties by only changing the property
defaults.project=my-project-name