android - react native : Failed to notify project evaluation listener. > JAVA_LETTER_OR_DIGIT

标签 android react-native android-studio gradle

当我尝试使用 react-native run-android 在 react-native 中运行 android 代码时出现错误。
我在 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
在 react native 中运行应用程序也会显示相同的错误。这些是我的 gradle 和 react-native 版本:
react 原生 cli:2.0.1
react 原生:0.51.0
梯度 4.4
项目级 build.gradle 文件。
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"
        }
    }
}

最佳答案

您的 RN 版本和 gradle 可能存在版本不匹配。对于 ReactNative 0.51,你应该使用 gradle 3.5。但这不是唯一的问题。您的项目已过时。您可能无法将您的应用发布到 Google Play 商店,因为 Google 引入了新的发布格式(App Bundle),您的发布 apk 将被 Play 商店拒绝。在此处查看更多信息:https://developer.android.com/platform/technology/app-bundle

为此,您需要升级到 gradle 5.5,并使用 React Native 进行此操作,您需要升级到 0.60+ 版本。在此处查看如何操作:https://facebook.github.io/react-native/docs/upgrading

如果您在升级当前项目时迷失了方向,另一种方法是初始化一个新项目,链接依赖项和逐 block 的 c/p 代码,并将您的代码调整为您使用的新版本的库(如有必要)。

关于android - react native : Failed to notify project evaluation listener. > JAVA_LETTER_OR_DIGIT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59095284/

相关文章:

android - 布局检查器显示 ID 的位置

android - publishProgress 不调用 onProgressUpdate

android - 基于 React Native 的 SDK

android - 是否可以在 docker 中运行 android 模拟器/android 应用程序?

reactjs - React Native Audio 将语音注释发送到后端

react-native - 删除标题 react 导航 v5

java - 在 Android Studio 中,如何弹出一个类可以实现的所有方法(并添加它们)?

java - 发生inflate异常 'androidx.appcompat:appcompat:1.1.0'

android - 如何更改 android 评级栏星级?

android - 在android中播放歌曲时显示时间