RAHUL JAIN
RAHUL JAIN

Reputation: 23

React Native: Failed to notify project evaluation listener. > JAVA_LETTER_OR_DIGIT

I'm getting error when i try to run android code in react native using react-native run-android.

I am running code on ubuntu.

 rahul@rahul-Inspiron-15-3567  ~/Documents/reactNative/crowdalert/CrowdAlert-Mobile   master ●  react-native run-android 
Scanning folders for symlinks in /home/rahul/Documents/reactNative/crowdalert/CrowdAlert-Mobile/node_modules (8ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...

> Configure project :app 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
Reading env from: .env
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
   > JAVA_LETTER_OR_DIGIT

* 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

running the app in react native too shows the same error.These are my versions of gradle and react-native:

react-native-cli: 2.0.1 react-native: 0.51.0 Gradle 4.4

Project level build.gradle file.

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.google.gms:google-services:4.3.2'
        classpath 'io.fabric.tools:gradle:1.25.1'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    maven {
            url "https://maven.google.com"
        }
    }
}

Upvotes: 2

Views: 1876

Answers (1)

pavle
pavle

Reputation: 939

You probably have a version mismatch with your RN version and gradle. For ReactNative 0.51, you should use gradle 3.5. But this is not the only problem. Your project is out of date. You probably won't be able to publish your app to Google Play store, because Google introduced new publishing format (App Bundle) and your release apk will be rejected by the Play store. See more here: https://developer.android.com/platform/technology/app-bundle

To make that possible, you need to upgrade to gradle 5.5, and do that with React Native, you'll need to upgrade to 0.60+ version. See how to do that here: https://facebook.github.io/react-native/docs/upgrading

If you get lost upgrading the current project, alternative is to initialize a new project, link dependencies and c/p block-by-block of your code and adjust your code to new versions of libraries you use (if necessary).

Upvotes: 1

Related Questions