【发布时间】:2019-01-17 09:19:07
【问题描述】:
我正在尝试从我的 React Native 应用程序启动 android 模拟器,但是,它抛出以下错误并且模拟器无法在我的 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 的新手,谁能建议我如何解决这个问题?
【问题讨论】:
-
行前一定还有一些错误 * 出了什么问题:请也发布。
-
已更新。请检查一次
-
问题出在你的 java 文件 MainApplication.java,我建议在 Android studio 中打开 android 文件夹。然后转到这个文件。在那里你将能够解决它,很可能是导入错误 BuildConfig
-
我刚刚修好了。谢谢
标签: android reactjs react-native android-emulator build.gradle