Не удалось выполнить задачу ': app: compileDebugJavaWithJavac'.Приложение React Native для Android - PullRequest
0 голосов
/ 17 января 2019

Я пытаюсь запустить эмулятор Android из моего приложения React Native, но его ошибка выдает следующее сообщение, и эмулятор не может запуститься в моей системе MAC.

Ошибка

    Configure project :app
     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

     Configure project :react-native-app
     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
     WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
     It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
    WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
     It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

      Configure project :react-native-version-number
     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
     WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (27.0.3) for
 Android Gradle Plugin 3.1.4.
     Android SDK Build Tools 27.0.3 will be used.
     To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin
 now has a default version of the build tools.

     Download https://dl.google.com/dl/android/maven2/com/android/support/multidex/1.0.2/multidex-1.0.2.pom
     Download https://dl.google.com/dl/android/maven2/com/android/support/multidex/1.0.2/multidex-1.0.2.aar

      Task :app:compileDebugJavaWithJavac FAILED
     /Users/anilkumar/Documents/projectName/android/app/src/main/java/com/projectName/MainApplication.java:19:
 error: cannot find symbol
           return BuildConfig.DEBUG;
                  ^
       symbol: variable BuildConfig
     1 error



My build.gradle file

// Файл сборки верхнего уровня, в который можно добавить параметры конфигурации, общие для всех подпроектов / модулей.

    buildscript {
        ext {
            buildToolsVersion = "27.0.3"
            minSdkVersion = 16
            compileSdkVersion = 27
            targetSdkVersion = 26
            supportLibVersion = "27.1.1"
        }
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.4'

            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

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


    task wrapper(type: Wrapper) {
        gradleVersion = '4.4'
        distributionUrl = distributionUrl.replace("bin", "all")
    }

Я очень новичок в React Native, может кто-нибудь подсказать мне, как это исправить?

1 Ответ

0 голосов
/ 17 января 2019

Наконец я нашел ответ, добавив следующий код

оператор импорта в MainApplication.java:

import com.facebook.react.BuildConfig;

Найден ответ по следующей ссылке

Реагирует на собственную ошибку сборки Android MainActivity.java:29: ошибка: не удается найти символ

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...