when implementing react-native-tesseract-ocr in your project:

Attempting to run the Android application...

[email protected] android react-native run-android

Information: JS server is already running. The app installation process is in progress.

This build contains deprecated Gradle features that are incompatible with Gradle 8.0.

You can use '--warning-mode all' to identify individual deprecation warnings and determine if they originate from your scripts or plugins.

View 5 actionable tasks: 5 up-to-date

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where: Build file 'D:\OCR2\node_modules\react-native-tesseract-ocr\android\build.gradle' line: 23

  • What went wrong: An issue was encountered while evaluating project ':react-native-tesseract-ocr'.

Plugin with id 'maven' not found.

  • Try:

Run with --stacktrace option for a detailed stack trace. Run with --info or --debug option for additional log output. Run with --scan for comprehensive insights. ==============================================================================

2: Task failed with an exception.

  • What went wrong: A problem occurred during the configuration of project ':react-native-tesseract-ocr'.

com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle

  • Try:

Run with --stacktrace option for the stack trace. Run with --info or --debug option for detailed logging. Run with --scan for full insights. ==============================================================================

  • For further assistance, visit

BUILD FAILED in 6 seconds

Error: The app installation failed. Ensure that the Android development environment is configured correctly: https://reactnative.dev/docs/environment-setup. Specific Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • Where: Build file 'D:\OCR2\node_modules\react-native-tesseract-ocr\android\build.gradle' line: 23

  • What went wrong: An issue was encountered while evaluating project ':react-native-tesseract-ocr'.

Plugin with id 'maven' not found.

  • Try:

Run with --stacktrace option for a detailed stack trace. Run with --info or --debug option for additional log output. Run with --scan for comprehensive insights. ==============================================================================

2: Task failed with an exception.

  • What went wrong: A problem occurred during the configuration of project ':react-native-tesseract-ocr'.

com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle

  • Try:

Run with --stacktrace option for the stack trace. Run with --info or --debug option for detailed logging. Run with --scan for full insights. ==============================================================================

  • For further assistance, visit

BUILD FAILED in 6 seconds

at makeError (D:\OCR2\node_modules\execa\index.js:174:9)
at D:\OCR2\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:\OCR2\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\OCR2\node_modules\@react-native-community\cli\build\index.js:142:9)

For more information, run CLI with the --verbose flag.

D:\OCR2> npm i rn-text-detector --save

Added 1 package, audited 974 packages in 3 seconds

102 packages are seeking funding Run npm fund for details

No vulnerabilities found

Completed steps: D:\OCR2>

Answer №1

I finally discovered the answer!

android/build.gradle

 ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31
                 kotlinVersion = "1.5.31"   //this is the key line to focus on ----------- 

        if (System.properties['os.arch'] == "aarch64") {
            // M1 Users must use NDK version 24 with aarch64 support
            ndkVersion = "24.0.8215888"
        } else {
            // Default to default NDK version from AGP.
            ndkVersion = "21.4.7075529"
        }
    }

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Attempting to trigger a second modal confirmation from within a modal confirmation

I've been struggling to solve a problem and I haven't had any luck. Can someone please help me? Here is the desired outcome: I already have a modal dialog that pops up. It contains two buttons: Ok and Cancel. When I click on the Ok button, it ...

Exploring label-value pairs and extracting values using Jquery

Looking for labels with partially matching strings in order to find associated values is my current task. Below is a snippet of the source code: <dt> Loose Ones </dt> <dd> 8.00 </dd> <dt> ...

Looking to create applications for Android and iOS that can integrate with a module designed in Adobe Captivate

I have created an interactive e-learning module using Adobe Captivate, which has been published in both HTML5 and SWF formats. The module includes some interactive elements/actions that can be accessed by clicking on them. It works perfectly fine in a web ...

Is there a way to position the image at the exact center of the column?

Currently, I am attempting to design a container that includes an image on the left, a title and description in the center, and a button on the right. However, I am facing difficulties centering the image in the first column and the button in the last colu ...

What is the best way to retrieve the 'items' data stored in this list?

I am working with a list of data that includes 6 categories - bags, shoes, girls, boys. Each category contains the same type of data like id, items (with properties: desc, id, imageUrl, name, price), routeName, and title. My goal is to loop through all ca ...

Make sure to close all your tags properly in PHP

Within my <textarea>, I am giving users the ability to submit content. The specific tags I want to allow include <b>, <i>,<blockquote>, and <del>. In order to prevent any unclosed tags since this content will be displayed on t ...

Discover the Color's Value in Relation to a Different Color

When it comes to my CSS, I like to use .scss to make as many variables as possible. It's easy to create a variable for one color, like $primary-color. From there, I want to work with different shades of that color, which I can easily pinpoint using Ph ...

When simulating a React component, it is essential to note that the property 'default' must

Upon embarking on a new React/Next.js project, I encountered an issue with mocking memoized React components that I had not experienced in previous projects. Despite my efforts, I could not figure out the root cause of this discrepancy. Allow me to provide ...

Error found when combining a stopwatch with the react useState hook and setInterval, causing an additional interval to start when the stopwatch

I have implemented a stopwatch feature that includes start and pause buttons. The start button triggers setInterval while the pause button calls clearInterval. Initially, pressing start and then pause works correctly. However, if you press start again afte ...

Completing the regex properly

When using my editor, I am able to paste a video URL which is then converted by regex into an embed code. The URL in the WYSIWYG-editor looks like this: Once converted, the output HTML appears as: <p>http://emedia.is.ed.ac.uk:8080/JW/wsconfig.xml& ...

Encountering issues with running npx create-next-app@latest

Recently, I encountered a problem while trying to create a new Next.js app where I received an npm ERR! ENOTEMPTY: directory not empty error. You can view the screenshot of the issue below: Screenshot Surprisingly, this has been working perfectly for the ...

Show each item in the list vertically, using a single unordered list but displaying them in

Is there a way to display list items vertically in multiple columns using only a single ul? I need the output to look like: a e i b f j c g d h Any suggestions on how to achieve this would be greatly appreciated. Thank you! ...

The specified data type is not compatible with the current context and cannot be treated as an array

Just starting out with TypeScript and I've encountered an issue that's preventing me from successfully building my app. Everything runs smoothly on my local environment, but as soon as I try to build it, an error pops up. Here's a snippet o ...

What is the best way to ensure that all of my images are the same size?

I've been working on making my pictures of varying resolutions the same size here, but no matter what I try, it just doesn't seem to work. Here is what I'm getting: . When I change the state to 1, 2, 3, or 4, I want it to look like this: her ...

Node timers exhibiting unexpected behavior contrary to documented specifications

Feeling a bit lost with this one. I'm running Ubuntu and using nvm for node. I made sure to uninstall the version of node installed via apt just to be safe. node --version > v10.10.0 npm --version > 6.4.1 So, I go ahead and create-react-app a ...

How to retrieve a variable from an object within an array using AngularJS code

I recently started learning TypeScript and AngularJS, and I've created a new class like the following: [*.ts] export class Test{ test: string; constructor(foo: string){ this.test = foo; } } Now, I want to create multiple in ...

What is the best way to include a button at the bottom of a Material UI table?

I've been working with Material UI in React TypeScript and I'm having trouble adding a button at the bottom that leads to a form. Despite my attempts, I haven't been successful. Can someone please help me with this? I just need a simple butt ...

How can I retrieve data on the address that is currently displayed using Google Autocomplete?

I am implementing a feature where users can enter their location, and I want to automatically fetch and fill in the city, state, and zip code based on the entered location. I came across an example that demonstrates this functionality here and am trying to ...

"Quotes are essential in Javastript syntax for specifying string values

I need to implement a JavaScript syntax to generate unique URLs for each image. The Robohash website provides random robot images based on different URL endings. I tried the code below, but it seems like ${props.id} is being interpreted as part of the UR ...

div with fixed position and scrollable content

I'm exploring ways to create a simple webpage layout inspired by the traditional index setup. The idea is to have a fixed header/navbar div that is 200px in height, with a second div below it containing scrollable content that fills the remaining vert ...