Я установил реактивную-локальную навигацию локально внутри проекта, даже в этом случае отображается сообщение об ошибке: compileDebugJavaWith Javac FAILED. Затем я попробовал cd android, а затем запустил gradlew clean, однако ошибка не исчезла. Проверьте полную ошибку:
Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings
302 actionable tasks: 1 executed, 301 up-to-date
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:2: error: package com.reactnativenavigation does not exist
import com.reactnativenavigation.NavigationActivity;
^
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:8: error: cannot find symbol
public class MainActivity extends NavigationActivity {
^
symbol: class NavigationActivity
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:15: error: method does not override or implement a method from a supertype
@Override
^
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:17: error: cannot find symbol
return new ReactActivityDelegate(this, getMainComponentName()) {
^
symbol: method getMainComponentName()
location: class MainActivity
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:20: error: incompatible types: MainActivity cannot be converted to Context
return new RNGestureHandlerEnabledRootView(MainActivity.this);
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
5 errors
FAILURE: Build 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 8s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:2: error: package com.reactnativenavigation does not exist
import com.reactnativenavigation.NavigationActivity;
^
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:8: error: cannot find symbol
public class MainActivity extends NavigationActivity {
^
symbol: class NavigationActivity
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:15: error: method does not override or implement a method from a supertype
@Override
^
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:17: error: cannot find symbol
return new ReactActivityDelegate(this, getMainComponentName()) {
^
symbol: method getMainComponentName()
location: class MainActivity
C:\Users\User\Baaz\android\app\src\main\java\com\baaz\MainActivity.java:20: error: incompatible types: MainActivity cannot be converted to Context
return new RNGestureHandlerEnabledRootView(MainActivity.this);
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
5 errors
FAILURE: Build 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 8s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\User\Baaz\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (C:\Users\User\Baaz\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\User\Baaz\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async Command.handleAction (C:\Users\User\Baaz\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:164:9)
Ниже приведена основная mainactivvity. java file
MainActivity . java
package com.baaz;
import com.reactnativenavigation.NavigationActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
public class MainActivity extends NavigationActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected ReactRootView createRootView() {
return new RNGestureHandlerEnabledRootView(MainActivity.this);
}
};
}
}
MainApplication. java
package com.baaz;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.baaz.generated.BasePackageList;
import com.swmansion.reanimated.ReanimatedPackage;
import com.swmansion.rnscreens.RNScreensPackage;
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
import org.unimodules.adapters.react.ReactAdapterPackage;
import org.unimodules.adapters.react.ModuleRegistryAdapter;
import org.unimodules.adapters.react.ReactModuleRegistryProvider;
import org.unimodules.core.interfaces.Package;
import org.unimodules.core.interfaces.SingletonModule;
import expo.modules.constants.ConstantsPackage;
import expo.modules.permissions.PermissionsPackage;
import expo.modules.filesystem.FileSystemPackage;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactModuleRegistryProvider mModuleRegistryProvider = new ReactModuleRegistryProvider(
new BasePackageList().getPackageList(),
Arrays.<SingletonModule>asList()
);
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReanimatedPackage(),
new RNGestureHandlerPackage(),
new RNScreensPackage(),
new ModuleRegistryAdapter(mModuleRegistryProvider)
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
пакет. json
{
"scripts": {
"start": "react-native start",
"android": "cd ./android && ./gradlew app:assembleDebug && ./gradlew installDebug",
"ios": "react-native run-ios",
"web": "expo start --web",
"postinstall": "jetify"
},
"dependencies": {
"expo": "~36.0.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "~0.61.4",
"react-native-gesture-handler": "~1.5.0",
"react-native-navigation": "^4.5.4",
"react-native-reanimated": "~1.4.0",
"react-native-screens": "~2.0.0-alpha.12",
"react-native-unimodules": "~0.7.0",
"react-native-web": "~0.11.7"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"babel-jest": "~24.9.0",
"jest": "~24.9.0",
"jetifier": "~1.6.4",
"metro-react-native-babel-preset": "~0.56.0",
"react-test-renderer": "~16.9.0",
"babel-preset-expo": "~8.0.0"
},
"private": true
}
Пожалуйста, ответьте и дайте мне знать, если для решения этой ошибки требуется что-то еще