Closed teilala closed 6 years ago
What version of React Native are you using? If it is >= 0.50.1
, then see this commit.
Specifically, change
reactContext.getJavaScriptContext()
to be the following instead
reactContext.getJavaScriptContextHolder().get()
and see if that fixes the error.
Try using master
, I've already submitted & @gre merged this PR https://github.com/react-community/react-native-webgl/pull/32
oops i need to do a new release
i resolve the issue .thanks guys Specifically, change reactContext.getJavaScriptContext() to be the following instead reactContext.getJavaScriptContextHolder().get() and see if that fixes the error.
in the code it is: reactContext.getJavaScriptContextHolder().get()
but i still get the error.
My package.json=
{ "name": "example", "version": "0.1.0", "private": true, "devDependencies": { "babel-preset-react-native-stage-0": "^1.0.1" }, "scripts": { "start": "react-native start", "android": "react-native run-android", "ios": "react-native run-ios" }, "dependencies": { "angle-normals": "^1.0.0", "bunny": "^1.0.1", "gl-mat4": "^1.1.4", "react": "16.0.0-alpha.5", "react-native": "0.49.3", "react-native-webgl": "file:..", "react-navigation": "1.0.0-beta.12", "regl": "^1.3.0", "three": "0.85.x" } }
and i do "react-native run android" from the "example" folder
now in react native version 0.49 you need to revert the change and change reactContext.getJavaScriptContextHolder().get() to reactContext.getJavaScriptContext()
maybe it is time to have two different versions?
I always got this error , when i build for android on windows ,
local.properties:
ndk.dir=E\:\\android\\android-ndk-r10d-windows-x86_64\\android-ndk-r10d
and settings.gradle:
`rootProject.name = 'swag' include ':react-native-camera' project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
include ':app' include ':react-native-camera' project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')
include ':react-native-webgl' project(':react-native-webgl').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webgl/android')
include ':RNWebGL' project(':RNWebGL').projectDir = file('../node_modules/react-native-camera/android')`
build error:
`F:\rn\swag\swag\node_modules\react-native-webgl\android\src\main\java\fr\greweb\ rnwebgl\RNWebGLView.java:50: error: cannot find symbol ctxId = RNWebGLContextCreate(reactContext.getJavaScriptContext()); ^ symbol: method getJavaScriptContext() location: variable reactContext of type ReactContext Note: F:\rn\swag\swag\node_modules\react-native-webgl\android\src\main\java\fr\g reweb\rnwebgl\RNWebGLViewManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error :react-native-webgl:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':react-native-webgl:compileReleaseJavaWithJavac'.
Try: Run with --info or --debug option to get more log output.
Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-n ative-webgl:compileReleaseJavaWithJavac'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex ecuteActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex ecute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExec uter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.exec ute(SkipUpToDateTaskExecuter.java:66) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execut e(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecu ter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter .execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execut e(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter .execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTa skWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTa skWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorW orker.processTask(AbstractTaskPlanExecutor.java:66) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorW orker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(Defaul tTaskPlanExecutor.java:25) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(Defau ltTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTask ExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute r.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExec uter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecu ter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildEx ecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute r.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecute r.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLa uncher.java:153) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul tBuildOperationExecutor.java:91) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul tBuildOperationExecutor.java:53) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default GradleLauncher.java:150) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGra dleLauncher.java:32) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradl eLauncher.java:98) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradl eLauncher.java:92) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul tBuildOperationExecutor.java:91) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul tBuildOperationExecutor.java:63) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle Launcher.java:92) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun cher.java:83) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildCon troller.run(InProcessBuildActionExecuter.java:99) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(Exe cuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildA ctionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce ssBuildActionExecuter.java:48) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce ssBuildActionExecuter.java:30) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(Contin uousBuildActionExecuter.java:81) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(Contin uousBuildActionExecuter.java:46) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.exe cute(DaemonUsageSuggestingBuildActionExecuter.java:51) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.exe cute(DaemonUsageSuggestingBuildActionExecuter.java:28) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43) at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.jav a:173) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction. execute(CommandLineActionFactory.java:239) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction. execute(CommandLineActionFactory.java:212) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRunti meValidationAction.java:35) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRunti meValidationAction.java:24) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep ortingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep ortingAction.java:22) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute( CommandLineActionFactory.java:205) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute( CommandLineActionFactory.java:169) at org.gradle.launcher.Main.doAction(Main.java:33) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBoots trap.java:55) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.j ava:36) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.ja va:30) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61) Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Com pilation failed; see the compiler error output for details. at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJava Compiler.java:48) at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJava Compiler.java:33) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegat eAndHandleErrors(NormalizingJavaCompiler.java:104) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute (NormalizingJavaCompiler.java:53) at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute (NormalizingJavaCompiler.java:38) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.exe cute(CleaningJavaCompilerSupport.java:35) at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.exe cute(CleaningJavaCompilerSupport.java:25) at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilat ionFinalizer.execute(IncrementalCompilationFinalizer.java:39) at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilat ionFinalizer.execute(IncrementalCompilationFinalizer.java:24) at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompi le.java:163) at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:127 ) at com.android.build.gradle.tasks.factory.AndroidJavaCompile.compile(And roidJavaCompile.java:49) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF actory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
actory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF actory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskF actory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex ecuteAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.ex ecuteActions(ExecuteActionsTaskExecuter.java:61) ... 60 more
BUILD FAILED`