gpt4 book ai didi

java - 如何修复 Android Studio 中 React Native App 丢失的符号和包?

转载 作者:太空狗 更新时间:2023-10-29 16:26:27 31 4
gpt4 key购买 nike

我的应用程序在 iOS 上运行,但我想在继续之前在 Android 中进行测试,但是当我尝试在 Android Studio 中构建时,出现以下 4 个错误:

PATH/uncvrd/MainApplication.java:14: error: cannot find symbol public class MainApplication extends ExpoApplication {
^ symbol: class ExpoApplication PATH/uncvrd/MainActivity.java:11: error: package com.uncvrd.generated does not exist import com.uncvrd.generated.DetachBuildConstants;
^ PATH/uncvrd/MainActivity.java:12: error: package com.uncvrd.experience does not exist import com.uncvrd.experience.DetachActivity;
^ PATH/uncvrd/MainActivity.java:14: error: cannot find symbol public class MainActivity extends DetachActivity {
^ symbol: class DetachActivity 4 errors :app:compileDevDebugJavaWithJavac FAILED

我是从CRNA过来的,弹射到ExpoKit。这是我的 MainApplication.java:

package com.uncvrd;

import com.facebook.react.ReactPackage;

import java.util.Arrays; import java.util.List;

// Needed for `react-native link` // import com.facebook.react.ReactApplication; import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage; import com.inprogress.reactnativeyoutube.ReactNativeYouTube; import com.oblador.vectoricons.VectorIconsPackage;

public class MainApplication extends ExpoApplication {

@Override public boolean isDebug() {
return BuildConfig.DEBUG; }

// Needed for `react-native link` public List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
// Add your own packages here!
// TODO: add native modules!

// Needed for `react-native link`
// new MainReactPackage(),
new ReactNativeOneSignalPackage(),
new ReactNativeYouTube(),
new VectorIconsPackage()
); }

@Override public String gcmSenderId() {
return getString(R.string.gcm_defaultSenderId); }

@Override public boolean shouldUseInternetKernel() {
return BuildVariantConstants.USE_INTERNET_KERNEL; } }

还有我的 MainActivity.java:

package com.uncvrd;

import android.os.Bundle;

import com.facebook.react.ReactPackage;

import java.util.ArrayList; import java.util.Arrays; import java.util.List;

import com.uncvrd.generated.DetachBuildConstants; import com.uncvrd.experience.DetachActivity;

public class MainActivity extends DetachActivity {

@Override public String publishedUrl() {
return "exp://exp.host/@jlewallen18/UNCVRD"; }

@Override public String developmentUrl() {
return DetachBuildConstants.DEVELOPMENT_URL; }

@Override public List<String> sdkVersions() {
return new ArrayList<>(Arrays.asList("26.0.0")); }

@Override public List<ReactPackage> reactPackages() {
return ((MainApplication) getApplication()).getPackages(); }

@Override public boolean isDebug() {
return BuildConfig.DEBUG; }

@Override public Bundle initialProps(Bundle expBundle) {
// Add extra initialProps here
return expBundle; } }

修复这些错误的最佳方法是什么?如果您需要更多信息,请告诉我

最佳答案

我们的团队忽略了生成的文件,但你需要它。如果将此添加到/android/app/src/main/java/host/exp/exponent/generated/DetachBuildConstants.java 是否有帮助?

package host.exp.exponent.generated;

public class DetachBuildConstants {

public static final String DEVELOPMENT_URL = "";

}

关于java - 如何修复 Android Studio 中 React Native App 丢失的符号和包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50322877/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com