I am trying to run the demo program for the CodenameOne CameraKit: https://github.com/codenameone/CameraKitDemo/ after reading https://www.codenameone.com/blog/camerakit-low-level-camera-api.html It compiles and runs in the simulator, but when I send it to the server to build, it gives me a build error.
Am I missing something?
I am using the IntelliJ IDE: IntelliJ IDEA 2018.1.1 (Community Edition) Build #IC-181.4445.78, built on April 9, 2018 JRE: 1.8.0_152-release-1136-b27 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.3 Latest Codename One plugin
Here follows the code, and the errors from the build server.
enter code here
package com.test;
import static com.codename1.ui.CN.*;
import com.codename1.camerakit.CameraEvent;
import com.codename1.camerakit.CameraKit;
import com.codename1.camerakit.CameraListener;
import com.codename1.components.FloatingActionButton;
import com.codename1.components.SpanLabel;
import com.codename1.components.ToastBar;
import com.codename1.ui.*;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.LayeredLayout;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import com.codename1.io.Log;
import java.io.IOException;
import com.codename1.ui.layouts.BoxLayout;
import com.codename1.io.NetworkEvent;
/**
* This file was generated by <a href="https://www.codenameone.com/">Codename One</a> for the purpose
* of building native mobile applications using Java.
*/
public class CameraDemo3 {
private Form current;
private Resources theme;
private CameraKit ck;
public void init(Object context) {
ck = CameraKit.create();
// use two network threads instead of one
updateNetworkThreadCount(2);
theme = UIManager.initFirstTheme("/theme");
// Enable Toolbar on all Forms by default
Toolbar.setGlobalToolbar(true);
// Pro only feature
Log.bindCrashProtection(true);
addNetworkErrorListener(err -> {
// prevent the event from propagating
err.consume();
if(err.getError() != null) {
Log.e(err.getError());
}
Log.sendLogAsync();
Dialog.show("Connection Error", "There was a networking error in the connection to " + err.getConnectionRequest().getUrl(), "OK", null);
});
}
public void start() {
if(ck != null && !ck.isStarted()) {
ck.start();
}
if(current != null){
current.show();
return;
}
Form hi = new Form("Native Camera", new LayeredLayout());
hi.setScrollableY(false);
if(ck != null) {
ck.addCameraListener(new CameraListener() {
@Override
public void onError(CameraEvent ev) {
// We currently get some errors on Android
Log.p(ev.getMessage() + " : " + ev.getExceptionMessage());
}
@Override
public void onImage(CameraEvent ev) {
ToastBar.showInfoMessage("Captured image bytes");
}
@Override
public void onVideo(CameraEvent ev) {
ToastBar.showInfoMessage("Captured video: " + ev.getFile());
}
});
hi.add(ck.getView());
Button video = new Button();
FontImage.setMaterialIcon(video, FontImage.MATERIAL_VIDEOCAM);
video.addActionListener(e -> {
Boolean b = (Boolean)video.getClientProperty("capturing");
if(b == null) {
video.putClientProperty("capturing", Boolean.TRUE);
ck.captureVideo();
FontImage.setMaterialIcon(video, FontImage.MATERIAL_VIDEOCAM_OFF);
} else {
video.putClientProperty("capturing", null);
ck.stopVideo();
FontImage.setMaterialIcon(video, FontImage.MATERIAL_VIDEOCAM);
}
});
FloatingActionButton fab = FloatingActionButton.createFAB(FontImage.MATERIAL_CAMERA);
fab.bindFabToContainer(hi, CENTER, BOTTOM);
fab.addActionListener(e -> ck.captureImage());
Button toggleCamera = new Button();
FontImage.setMaterialIcon(toggleCamera, FontImage.MATERIAL_CAMERA_FRONT);
Button toggleFlash = new Button();
FontImage.setMaterialIcon(toggleFlash, FontImage.MATERIAL_FLASH_ON);
toggleCamera.addActionListener(e -> ck.toggleFacing());
toggleFlash.addActionListener(e -> ck.toggleFlash());
Container buttons = BoxLayout.encloseY(video, toggleCamera, toggleFlash);
buttons.setScrollableY(true);
hi.add(BorderLayout.east(buttons));
} else {
hi.add(BorderLayout.north(new SpanLabel("Loading native camera view")));
}
hi.show();
}
public void stop() {
current = getCurrentForm();
if(current instanceof Dialog) {
((Dialog)current).dispose();
current = getCurrentForm();
}
}
public void destroy() {
}
}
Build Server output:
User-level: 1000
Request Args:
-----------------
java.version=8
ios.NSCameraUsageDescription=We need camera access to grab pictures and videos
ios.newStorageLocation=true
-------------------
Executing: /home/ec2-user/android-sdk/tools/android create project --target android-23 --name CameraDemo3 --path /tmp/build9109673224646903413xxx/CameraDemo3 --activity CameraDemo3Stub --package com.test --gradle --gradle-version 2.0.0 Created directory /tmp/build9109673224646903413xxx/CameraDemo3/src/main/java
Created directory /tmp/build9109673224646903413xxx/CameraDemo3/src/main/java/com/test
...... cut to reduce length .....
Compiling with JDK Java compiler API.
/tmp/build9109673224646903413xxx/CameraDemo3/src/main/java/com/codename1/camerakit/impl/CameraNativeAccessImpl.java:3: error: package com.wonderkiln.camerakit does not exist
import com.wonderkiln.camerakit.*;
^
/tmp/build9109673224646903413xxx/CameraDemo3/src/main/java/com/codename1/camerakit/impl/CameraNativeAccessImpl.java:9: error: cannot find symbol
private CameraView view;
^
symbol: class CameraView
location: class CameraNativeAccessImpl
/tmp/build9109673224646903413xxx/CameraDemo3/src/main/java/com/codename1/camerakit/impl/CameraNativeAccessImpl.java:10: error: cannot find symbol
private CameraKitEventListener listener = new CameraKitEventListener() {
^
symbol: class CameraKitEventListener
location: class CameraNativeAccessImpl
/tmp/build9109673224646903413xxx/CameraDemo3/src/main/java/com/codename1/camerakit/impl/CameraNativeAccessImpl.java:10: error: cannot find symbol
private CameraKitEventListener listener = new CameraKitEventListener() {
^
symbol: class CameraKitEventListener
location: class CameraNativeAccessImpl
/tmp/build9109673224646903413xxx/CameraDemo3/src/main/java/com/codename1/camerakit/impl/CameraNativeAccessImpl.java:35: error: cannot find symbol
view = new CameraView(AndroidNativeUtil.getContext());
^
symbol: class CameraView
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors
:compileDebugJavaWithJavac FAILED
:compileDebugJavaWithJavac (Thread[Daemon worker,5,main]) completed. Took 7.792 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileDebugJavaWithJavac'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:45)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:40)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:47)
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:103)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:52)
at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:38)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:34)
at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilationFinalizer.execute(IncrementalCompilationFinalizer.java:38)
at org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilationFinalizer.execute(IncrementalCompilationFinalizer.java:24)
at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:157)
at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:127)
at com.android.build.gradle.tasks.factory.AndroidJavaCompile.compile(AndroidJavaCompile.java:49)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 68 more
BUILD FAILED
Total time: 18.103 secs
Stopped 0 compiler daemon(s).
Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':compileDebugJavaWithJavac'.] from daemon DaemonInfo{pid=11167, address=[46019278-8ed8-4606-8f74-3c03030b4a25 port:44179, addresses:[/0:0:0:0:0:0:0:1%lo, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=1240b5d8-39f4-4710-ac85-f3cf1a99af7f,javaHome=/home/ec2-user/jdk1.8.0_45,daemonRegistryDir=/home/ec2-user/.gradle/daemon,pid=11167,idleTimeout=120000,daemonOpts=-XX:MaxPermSize=512m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx2048m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
Process return code is 1