我正在运行这个rn应用程序没有问题。我不得不弹出expo。expo弹出后,我不能让项目运行。
因此,当我运行yarn android
时,构建失败并出现此错误。
J:\WORK\CURRENT\REACT_NATIVE\moot-RN\my\eject_try\moot-RN\android\app\src\main\java\ha\mootapp\MainActivity.java:22: error: package R does not exist
setTheme(R.style.AppTheme);
^
J:\WORK\CURRENT\REACT_NATIVE\moot-RN\my\eject_try\moot-RN\android\app\src\main\java\ha\mootapp\MainActivity.java:42: error: cannot find symbol
return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(
^
symbol: variable BuildConfig
location: class MainActivity
J:\WORK\CURRENT\REACT_NATIVE\moot-RN\my\eject_try\moot-RN\android\app\src\main\java\ha\mootapp\MainApplication.java:29: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
J:\WORK\CURRENT\REACT_NATIVE\moot-RN\my\eject_try\moot-RN\android\app\src\main\java\ha\mootapp\MainApplication.java:48: error: cannot find symbol
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
^
symbol: variable BuildConfig
J:\WORK\CURRENT\REACT_NATIVE\moot-RN\my\eject_try\moot-RN\android\app\src\main\java\ha\mootapp\MainApplication.java:53: error: cannot find symbol
return BuildConfig.IS_HERMES_ENABLED;
^
symbol: variable BuildConfig
J:\WORK\CURRENT\REACT_NATIVE\moot-RN\my\eject_try\moot-RN\android\app\src\main\java\ha\mootapp\MainApplication.java:66: error: cannot find symbol
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
^
symbol: variable BuildConfig
location: class MainApplication
6 errors
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (no error message)
* 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.
==============================================================================
所以看起来R和BuildConfig没有导入到MainApplication.java文件中。所以我手动添加了这个。import com.facebook.react.BuildConfig;
在我再次运行yarn android
之后,现在我得到这个错误。
A problem occurred configuring project ':react-native-gradle-plugin'.
> java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\User\.gradle\caches\jars-9\196b729407d7fbb2907378f4b4c34b5a\kotlin-gradle-plugin-1.6.10.jar.
我还看到了一些关于软件包名称问题的内容。
这是我的清单中的包名称-〉〉<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="ha.mootapp" xmlns:tools="http://schemas.android.com/tools">
和app/build.gradle -〉〉
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
namespace "com.moot"
defaultConfig {
applicationId 'ha.mootapp'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0.1"
}
有人知道出什么事了吗?
1条答案
按热度按时间8ulbf1ek1#
世博会48版似乎有一个问题。有一个github问题〉https://github.com/expo/expo/issues/21750我降级到45和建设是好的。