Build problems with CodenameOneCameraKit.cn1lib - build

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 Codename One 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

It looks like you took the cn1lib and tried to use the code instead of installing the cn1lib using the extension manager available in Codename One Settings.
I would suggest installing the extension.
If you would still want to use the code notice you also need to replicate the changes to build hints which are missing. These are within the properties files that are a part of the cn1lib.

Related

Quarkus kubernetesMockServer for application initialization

I am working on a Quarkus application to acct as an Operator in a OpenShift/Kubernetes cluster. When writing the tests using a kubernetesMockServer it is working fine for REST calls to developed application but when code runs inside an Initialization Block it is failing, in the log I see that mock server is replying with a 404 error:
2020-02-17 11:04:12,148 INFO [okh.moc.MockWebServer] (MockWebServer /127.0.0.1:53048) MockWebServer[57577] received request: GET /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions HTTP/1.1 and responded: HTTP/1.1 404 Client Error
On the TestCode I have:
#QuarkusTestResource(KubernetesMockServerTestResource.class)
#QuarkusTest
class TestAIRController {
#MockServer
KubernetesMockServer mockServer;
private CustomResourceDefinition crd;
private CustomResourceDefinitionList crdlist;
#BeforeEach
public void before() {
crd = new CustomResourceDefinitionBuilder()
.withApiVersion("apiextensions.k8s.io/v1beta1")
.withNewMetadata().withName("types.openshift.example-cloud.com")
.endMetadata()
.withNewSpec()
.withNewNames()
.withKind("Type")
.withPlural("types")
.endNames()
.withGroup("openshift.example-cloud.com")
.withVersion("v1")
.withScope("Namespaced")
.endSpec()
.build();
crdlist = new CustomResourceDefinitionListBuilder().withItems(crd).build();
mockServer.expect().get().withPath("/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions")
.andReturn(200, crdlist)
.always();
}
#Test
void test() {
RestAssured.when().get("/dummy").then().body("size()", Is.is(0));
}
}
The dummy rest is using the same code for searching the CRD, and in fact when running withouth the class observing the startup event it works fine
#Path("/dummy")
public class Dummy {
private static final Logger LOGGER =LoggerFactory.getLogger(Dummy.class);
#GET
#Produces(MediaType.APPLICATION_JSON)
public Response listCRDs(){
KubernetesClient oc = new DefaultKubernetesClient();
CustomResourceDefinition crd = oc.customResourceDefinitions()
.list().getItems().stream()
.filter( ob -> ob.getMetadata().getName().equals("types.openshift.example-cloud.com"))
.findFirst().get();
LOGGER.info("CRD NAME is {}", crd.getMetadata().getName());
return Response.ok(new ArrayList<String>()).build();
}
}
Finally this is an except of the
#ApplicationScoped
public class AIRWatcher {
private static final Logger LOGGER = LoggerFactory.getLogger(AIRWatcher.class);
void OnStart(#Observes StartupEvent ev) {
KubernetesClient oc = new DefaultKubernetesClient();
CustomResourceDefinition crd = oc.customResourceDefinitions()
.list().getItems().stream()
.filter( ob -> ob.getMetadata().getName().equals("types.openshift.example-cloud.com"))
.findFirst().get();
LOGGER.info("Using {}", crd.getMetadata().getName());
}
}
It's like for some reason the mock server is still not initialized for the Startup event, is there any way to solve it?
The problem is that the Mock Server is only configured to respond right before the test execution, while this code:
void OnStart(#Observes StartupEvent ev) {
KubernetesClient oc = new DefaultKubernetesClient();
CustomResourceDefinition crd = oc.customResourceDefinitions()
.list().getItems().stream()
.filter( ob -> ob.getMetadata().getName().equals("types.openshift.example-cloud.com"))
.findFirst().get();
LOGGER.info("Using {}", crd.getMetadata().getName());
}
runs when the application is actually comes up (which is before any #BeforeEach runs).
Can you please open an issue on the Quarkus Github? This should be something we provide a solution for

akka-quartz-scheduler: No matching quartz configuration found for schedule

I'm trying to run a sample of akka-quartz-scheduler, I got the akka-quickstart-java, and created a new main class for the scheduler sample, then I added the application.conf (under main/resources) and I added the dependencies to build.sbt.
I tried to load manually the Config with: ConfigFactory.load(), I got the content of the config file correctly, but it appears that the file is never seen by the schedulerExtension.
SchedulerQuickstart.java
public class SchedulerQuickstart {
public static void main(String[] args){
final ActorSystem system = ActorSystem.create("helloscheduler");
try {
QuartzSchedulerExtension schedulerExtension = new QuartzSchedulerExtension((ExtendedActorSystem) system);
Date firstExecutionDate=schedulerExtension.schedule("GreetingSchedule",
system.actorOf(Printer.props(), "printerActor"),
new Printer.Greeting("This is an scheduled message"));
}
catch (Exception ex){
}
finally {
system.terminate();
}
}
}
application.conf
akka.quartz.schedules {
GreetingSchedule {
description = "Task that fires off every 30 seconds"
expression = "*/30 * * ? * *"
maxRetries = 2
}
}
in build.sbt:
"com.enragedginger" %% "akka-quartz-scheduler" % "1.8.0-akka-2.5.x"
When I run the code, I got:
No matching quartz configuration found for schedule 'GreetingSchedule'

Glass Throwing Error

I have some questions regarding my block of code. I've tried running it in Netbeans and it doesn't seem to like this block of code on Google Glass. I compiled it using Eclipse and it seems to compile correctly as well.
package com.openglassquartz.helloglass;
import java.io.IOException;
import java.net.URL;
import java.util.Scanner;
public class OnlineRetrieval {
boolean activeGame;
public boolean checkGame() { //Method for which to check if there is a current game going on.
try {
URL url = new URL("http://danielchan.me/league/active.txt");
Scanner s = new Scanner(url.openStream()); //All errors point to this line of code??
int temporary_Reading = s.nextInt();
if(temporary_Reading == 1) {
return activeGame = true;
} else {
return activeGame = false;
}
} catch(IOException ex) {
ex.printStackTrace();
}
return activeGame;
}
}
From the LaunchService Class.
OnlineRetrieval OR = new OnlineRetrieval();
boolean temp_Check = OR.checkGame();
01-14 16:38:32.187: E/AndroidRuntime(18639): at com.openglassquartz.helloglass.OnlineRetrieval.checkGame(OnlineRetrieval.java:20)
01-14 16:38:32.187: E/AndroidRuntime(18639): at com.openglassquartz.helloglass.CardLaunchService.onStartCommand(CardLaunchService.java:77)
How can I fix this? It seems to work on Netbeans when I tried outputting it but not in Google Glass.
Two things to look at (it looks like your stack trace is cut off in your post):
Did you add the android.permission.INTERNET permission to your application's manifest?
Is this code being called in the main UI thread? Network operations must be executed in a background thread – you may want to look at the AsyncTask class as a way of handling this.

FFmpegFrameRecorder Issue

While using FFmpegFrameRecorder from JavaCV the JVM crashes with the following message :
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000699d6a64, pid=4076, tid=308
#
# JRE version: 7.0_13-b20
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.7-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [avformat-54.dll+0xd6a64] av_read_play+0x4
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Sagar Jadhav\Documents\NetBeansWorkspace\OpenCV\hs_err_pid4076.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Java Result: 1
The code is as follows :
package com.opencv.windows;
import com.googlecode.javacv.CanvasFrame;
import com.googlecode.javacv.FFmpegFrameGrabber;
import com.googlecode.javacv.FFmpegFrameRecorder;
import com.googlecode.javacv.OpenCVFrameGrabber;
import com.googlecode.javacv.cpp.opencv_core;
public class VideoRecorderDemo
{
OpenCVFrameGrabber grabber;
FFmpegFrameRecorder recorder;
CanvasFrame canvasFrame;
VideoRecorderDemo()
{
grabber = new OpenCVFrameGrabber("c:\\sample.mp4");
recorder = new FFmpegFrameRecorder("c:\\sample1.mp4", 2);
canvasFrame = new CanvasFrame("Video Recorder Demo");
canvasFrame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
try
{
grabber.start();
opencv_core.IplImage image;
while((canvasFrame.isVisible()) && (image = grabber.grab()) != null)
canvasFrame.showImage(image);
}
catch(Exception e)
{
System.out.println("Error : " + e.getMessage());
}
init();
startRecording();
stopRecording();
}
void init()
{
try
{
grabber.start();
recorder.start();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
void startRecording()
{
try
{
opencv_core.IplImage image;
while((canvasFrame.isVisible()) && (image = grabber.grab()) != null)
{
recorder.record(image);
canvasFrame.showImage(image);
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
void stopRecording()
{
try
{
grabber.stop();
recorder.stop();
canvasFrame.dispose();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
public static void main(String args[])
{
new VideoRecorderDemo();
}
}
I am using OpenCV 2.4.3 libs and the ffmpeg libs provided from zeronoe (ffmpeg-20130209-git-969039e-win64-shared)
Thanks
u must use this version of ffmpeg:
http://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-20121029-git-11d695d-win64-shared.7z
i had ur problem but i searched the JavaCV readme file and i found that JavaCV has been compiled with this version of ffmpeg
good luck

How do I invoke Multiple Startup Projects when running a unit tests in Debug Mode

This seems like a simple thing to do but I can't seem to find any info anywhere! I've got a solution that has a service that we run in 'Console Mode' when debugging. I want it to be started and 'attached' when I run my unit test from Visual Studio.
I'm using Resharper as the unit test runner.
Not a direct answer to your question, BUT
We faced a similar problem recently and eventually settled on a solution using AppDomain
As your solution is already running as a Console project it would be little work to make it boot in a new AppDomain. Furthermore, you could run Assertions on this project as well as part of unit testing. (if required)
Consider the following static class Sandbox which you can use to boot multiple app domains.
The Execute method requires a Type which is-a SandboxAction. (class definition also included below)
You would first extend this class and provide any bootup actions for running your console project.
public class ConsoleRunnerProjectSandbox : SandboxAction
{
protected override void OnRun()
{
Bootstrapper.Start(); //this code will be run on the newly create app domain
}
}
Now to get your app domain running you simply call
Sandbox.Execute<ConsoleRunnerProjectSandbox>("AppDomainName", configFile)
Note you can pass this call a config file so you can bootup your project in the same fashion as if you were running it via the console
Any more questions please ask.
public static class Sandbox
{
private static readonly List<Tuple<AppDomain, SandboxAction>> _sandboxes = new List<Tuple<AppDomain, SandboxAction>>();
public static T Execute<T>(string friendlyName, string configFile, params object[] args)
where T : SandboxAction
{
Trace.WriteLine(string.Format("Sandboxing {0}: {1}", typeof (T).Name, configFile));
AppDomain sandbox = CreateDomain(friendlyName, configFile);
var objectHandle = sandbox.CreateInstance(typeof(T).Assembly.FullName, typeof(T).FullName, true, BindingFlags.Default, null, args, null, null, null);
T sandBoxAction = objectHandle.Unwrap() as T;
sandBoxAction.Run();
Tuple<AppDomain, SandboxAction> box = new Tuple<AppDomain, SandboxAction>(sandbox, sandBoxAction);
_sandboxes.Add(box);
return sandBoxAction;
}
private static AppDomain CreateDomain(string name, string customConfigFile)
{
FileInfo info = customConfigFile != null ? new FileInfo(customConfigFile) : null;
if (!string.IsNullOrEmpty(customConfigFile) && !info.Exists)
throw new ArgumentException("customConfigFile not found using " + customConfigFile + " at " + info.FullName);
var appsetup = new AppDomainSetup();
//appsetup.ApplicationBase = Path.GetDirectoryName(typeof(Sandbox).Assembly.Location);
appsetup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
if (customConfigFile==null)
customConfigFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
appsetup.ConfigurationFile = customConfigFile;
var sandbox = AppDomain.CreateDomain(
name,
AppDomain.CurrentDomain.Evidence,
appsetup);
return sandbox;
}
public static void DestroyAppDomainForSandbox(SandboxAction action)
{
foreach(var tuple in _sandboxes)
{
if(tuple.Second == action)
{
AppDomain.Unload(tuple.First);
Console.WriteLine("Unloaded sandbox ");
_sandboxes.Remove(tuple);
return;
}
}
}
}
[Serializable]
public abstract class SandboxAction : MarshalByRefObject
{
public override object InitializeLifetimeService()
{
return null;
}
public void Run()
{
string name = AppDomain.CurrentDomain.FriendlyName;
Log.Info("Executing {0} in AppDomain:{1} thread:{2}", name, AppDomain.CurrentDomain.Id, Thread.CurrentThread.ManagedThreadId);
try
{
OnRun();
}
catch (Exception ex)
{
Log.Error(ex, "Exception in app domain {0}", name);
throw;
}
}
protected abstract void OnRun();
public virtual void Stop()
{
}
}