Android wear sample code exception - wear-os

Afrer I build the sample code and install it on my Nexus 4.
I use Eclipse and import WearableNotificationsSample, ElizaChat sample code of AndroidWearPreview.
It failed. why?
03-20 14:34:34.418: E/AndroidRuntime(9989): Process: com.example.android.preview.support.wearable.notifications, PID: 9989
03-20 14:34:34.418: E/AndroidRuntime(9989): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.preview.support.wearable.notifications/com.example.android.preview.support.wearable.notifications.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.android.preview.support.wearable.notifications.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.preview.support.wearable.notifications-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.preview.support.wearable.notifications-2, /vendor/lib, /system/lib]]
03-20 14:34:34.418: E/AndroidRuntime(9989): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
03-20 14:34:34.418: E/AndroidRuntime(9989): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
03-20 14:34:34.418: E/AndroidRuntime(9989): at android.app.ActivityThread.access$800(ActivityThread.java:135)
03-20 14:34:34.418: E/AndroidRuntime(9989): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-20 14:34:34.418: E/AndroidRuntime(9989): at android.os.Handler.dispatchMessage(Handler.java:102)
03-20 14:34:34.418: E/AndroidRuntime(9989): at android.os.Looper.loop(Looper.java:136)
03-20 14:34:34.418: E/AndroidRuntime(9989): at android.app.ActivityThread.main(ActivityThread.java:5017)
03-20 14:34:34.418: E/AndroidRuntime(9989): at java.lang.reflect.Method.invokeNative(Native Method)
03-20 14:34:34.418: E/AndroidRuntime(9989): at java.lang.reflect.Method.invoke(Method.java:515)
03-20 14:34:34.418: E/AndroidRuntime(9989): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
03-20 14:34:34.418: E/AndroidRuntime(9989): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
03-20 14:34:34.418: E/AndroidRuntime(9989): at dalvik.system.NativeStart.main(Native Method)
03-20 14:34:34.418: E/AndroidRuntime(9989): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.android.preview.support.wearable.notifications.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.android.preview.support.wearable.notifications-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.android.preview.support.wearable.notifications-2, /vendor/lib, /system/lib]]
03-20 14:34:34.418: E/AndroidRuntime(9989): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-20 14:34:34.418: E/AndroidRuntime(9989): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
03-20 14:34:34.418: E/AndroidRuntime(9989): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
03-20 14:34:34.418: E/AndroidRuntime(9989): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
03-20 14:34:34.418: E/AndroidRuntime(9989): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)

I noticed the source code is in the java folder. To run this on eclipse, the fix was to right click on the java folder and select Build Path -> Use as Source Folder
Also add the support and android wearable-preview libraries of course

(Sorry, not enough reputation for posting a comment)
Having the same issue. I'm using Eclipse and did the suggested actions:
In your Android app project, create a libs/ directory in your project root (the same location as the AndroidManifest.xml file).
Copy the v4 support library JAR file from your Android SDK directory (e.g., /extras/android/support/v4/android-support-v4.jar) into your project libs/ directory.
Also save the wearable-preview-support.jar file in the libs/ directory.
Right click each JAR file and select Build Path > Add to Build Path.
Installed Android Studio and imported it, it's working right away...

Create "libs" folder at root level then copy "android-support-v4.jar" & "wearable-preview-support.jar". Then right click on each jar file then select "Build Path->Add Build Path".
Right click on "Java" folder from project & select "Build Path -> Use as Source Folder".
And build it. I hope this will resolve.

I had the same problem. I compared my project with the same project loaded in another Eclipse that was working.
In the working project, the android-support-v4.jar is included both in the "Referenced libraries" folder, and in the "Android private libraries" folder. In the failing project, the file only appeared under the "Referenced libraries".
So it seems, in some Eclipse instances, the "Build Path > Add to Build Path" does not work as expected, but I was not able to make it work :-(

Related

JavaFX project works in IntelliJ, but not when I clone from a git remote repository and run 'gradle wrapper' and './gradlew run'

all! Three other people and I have recently completed a Java project, which is a recreation of the game Pokemon. Here is a link to the project:
https://github.com/Pirate-Hunter-Zoro/Pokemon
The following screen recording should show that the project runs successfully on IntelliJ: https://screencast-o-matic.com/watch/c3lXbNVvrqX
However, when I try to clone this project from Git, and run 'gradle wrapper' and then './gradlew run', while the application does launch, I cannot make it past the intro screen, as this video shows:
https://somup.com/c3lXbRww2Y
Finally, here is the resulting error message:
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml#19/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1857)
at javafx.fxml#19/javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1724)
at javafx.base#19/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at javafx.base#19/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:234)
at javafx.base#19/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
at javafx.base#19/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
at javafx.base#19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at javafx.base#19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base#19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base#19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base#19/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base#19/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base#19/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base#19/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base#19/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics#19/javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3599)
at javafx.graphics#19/javafx.scene.Scene$MouseHandler.process(Scene.java:3903)
at javafx.graphics#19/javafx.scene.Scene.processMouseEvent(Scene.java:1887)
at javafx.graphics#19/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2620)
at javafx.graphics#19/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
at javafx.graphics#19/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics#19/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
at javafx.graphics#19/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
at javafx.graphics#19/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
at javafx.graphics#19/com.sun.glass.ui.View.handleMouseEvent(View.java:551)
at javafx.graphics#19/com.sun.glass.ui.View.notifyMouse(View.java:937)
at javafx.graphics#19/com.sun.glass.ui.mac.MacView.notifyMouse(MacView.java:127)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.sun.javafx.reflect.Trampoline.invoke(MethodUtil.java:77)
at jdk.internal.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at javafx.base#19/com.sun.javafx.reflect.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml#19/com.sun.javafx.fxml.MethodHelper.invoke(MethodHelper.java:84)
at javafx.fxml#19/javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1852)
... 27 more
Caused by: java.lang.IllegalArgumentException: Invalid URL: Invalid URL or resource not found
at javafx.graphics#19/javafx.scene.image.Image.validateUrl(Image.java:1138)
at javafx.graphics#19/javafx.scene.image.Image.<init>(Image.java:628)
at csci205_final_project#0.1-SNAPSHOT/org.Fearsome_Foursome.Application.Controllers.ArenaController.setUpNameSpriteHealth(ArenaController.java:190)
at csci205_final_project#0.1-SNAPSHOT/org.Fearsome_Foursome.Application.HelloPokemon.loadScene(HelloPokemon.java:102)
at csci205_final_project#0.1-SNAPSHOT/org.Fearsome_Foursome.Application.Controllers.MenuController.showArena(MenuController.java:108)
at csci205_final_project#0.1-SNAPSHOT/org.Fearsome_Foursome.Application.Controllers.MenuController.setHard(MenuController.java:132)
... 38 more
Caused by: java.lang.IllegalArgumentException: Invalid URL or resource not found
at javafx.graphics#19/javafx.scene.image.Image.validateUrl(Image.java:1123)
Please let me know if there is any more information I should get a hold of and share!
Many thanks for any help anyone could offer!
I tried to clone a repository and use 'gradle wrapper' and './gradlew run', expecting the application to work. The application launches, but does not work.

How to run a shell script in SVN from "Execute Shell" in Jenkins?

I have a shell script called restart_server.sh stored in SVN. I have set up a new job in Jenkins with SVN configuration and the command in "Execute Shell" is bash -ex restart-server.sh
However when I do a build, I get the below error. Any ideas on what I am missing?
FATAL: command execution failed
java.io.IOException: Cannot run program "sh" (in directory "E:\project\jenkins\workspace\Restart_Server_Shell"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:780)
at hudson.Launcher$ProcStarter.start(Launcher.java:360)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:97)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:772)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:535)
at hudson.model.Run.execute(Run.java:1732)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:234)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:385)
at java.lang.ProcessImpl.start(ProcessImpl.java:136)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
... 15 more
Build step 'Execute shell' marked build as failure
Finished: FAILURE```

Compilation Error while executing maven project through Jenkins

I am trying to execute maven project through jenkins but getting this error. I have not changed the default permission settings::
Started by user kashmir
Building in workspace C:\Users\kashmir\.jenkins\workspace\Test.SampleItem
Parsing POMs
Established TCP socket on 52587
[Test.Sample] $ /bin/java -cp C:\Users\kashmir\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.12-alpha-1.jar;C:\Users\kashmir\.jenkins\tools\hudson.tasks.Maven_MavenInstallation\TestMaven\boot\plexus-classworlds-2.5.2.jar;C:\Users\kashmir\.jenkins\tools\hudson.tasks.Maven_MavenInstallation\TestMaven/conf/logging jenkins.maven3.agent.Maven35Main C:\Users\kashmir\.jenkins\tools\hudson.tasks.Maven_MavenInstallation\TestMaven C:\Users\kashmir\.jenkins\war\WEB-INF\lib\remoting-3.17.jar C:\Users\kashmir\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.12-alpha-1.jar C:\Users\kashmir\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.12-alpha-1.jar 52587
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "/bin/java" (in directory "C:\Users\kashmir\Documents\SELENIUM_PROJECT\Test.Sample"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:249)
at hudson.Proc$LocalProc.<init>(Proc.java:218)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
at hudson.Launcher$ProcStarter.start(Launcher.java:449)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:278)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:804)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1727)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 13 more
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/testng-results.xml
Did not find any matching files.
Finished: FAILURE

Can't compile MediaRouteButton into project

I'm doing in Movie project with CastButton, I completed a sample and this worked perfect. But when I'm doing in true project I have a problem.
I imported compile into my grande file, but when I create MediaRouteButton I have I got error, I tried many ways but I can't fix it, so I now I really need a help:
This is: compile file:
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:mediarouter-v7:25.0.0'
compile 'com.googlecode.android-query:android-query:0.25.9'
compile 'com.google.android.gms:play-services-cast-framework:10.2.0'
this is logcat:
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/app/MediaRouteButton;
at com.jlabs.pluginplayer.view.MediaPlayerView.addMediaButton(MediaPlayerView.java:533)
at com.jlabs.pluginplayer.view.MediaPlayerView.access$4200(MediaPlayerView.java:53)
at com.jlabs.pluginplayer.view.MediaPlayerView$3.run(MediaPlayerView.java:514)
at android.app.Activity.runOnUiThread(Activity.java:5524)
at com.jlabs.pluginplayer.view.MediaPlayerView.preload(MediaPlayerView.java:490)
at com.jlabs.pluginplayer.PlayerActivity.onResume(PlayerActivity.java:330)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1258)
at android.app.Activity.performResume(Activity.java:6327)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3092)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.app.MediaRouteButton" on path: DexPathList[[zip file "/data/app/jp.tsutayamovie-1/base.apk"],nativeLibraryDirectories=[/data/app/jp.tsutayamovie-1/lib/arm, /data/app/jp.tsutayamovie-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.jlabs.pluginplayer.view.MediaPlayerView.addMediaButton(MediaPlayerView.java:533) 
at com.jlabs.pluginplayer.view.MediaPlayerView.access$4200(MediaPlayerView.java:53) 
at com.jlabs.pluginplayer.view.MediaPlayerView$3.run(MediaPlayerView.java:514) 
at android.app.Activity.runOnUiThread(Activity.java:5524) 
at com.jlabs.pluginplayer.view.MediaPlayerView.preload(MediaPlayerView.java:490) 
at com.jlabs.pluginplayer.PlayerActivity.onResume(PlayerActivity.java:330) 
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1258) 
at android.app.Activity.performResume(Activity.java:6327) 
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3092) 
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
Suppressed: java.lang.ClassNotFoundException: android.support.v7.app.MediaRouteButton
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 20 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
How can I fix it?
Based from this thread, you are getting that error because of the following reasons:
In your gradle build file, maybe your app is targeting and compiling with the beta version of android that is still in development with:
compileSdkVersion 'android-L'
buildToolsVersion '20'
as well as
minSdkVersion 20
targetSdkVersion 20
First thing to note is that this app will not run correctly (at this time) on any device without android-L flashed to it.
Additional reference: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/os/BuildCompat
Check your classpath contains that jar (AppCompat), if your classpath doesn't contain the jar then just add that class in your classpath.
Hope this helps!

Maven error in Jenkins

I have an error in Jenkins when I try to build my maven-project.
I've installed the maven plugin and also configured it. I'm using a pom.xml and the default maven settings.
Can someone help me?
Parsing POMs
[maven-plugin] $
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "java" (in directory "/.../org.jenkins-ci.main/maven-plugin"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:815)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:266)
at hudson.maven.ProcessCache.get(ProcessCache.java:236)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:755)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
at hudson.model.Run.execute(Run.java:1738)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 12 more
Finished: FAILURE
The configuration of my job is similar as in this video at 2.08
Maven configuration:
configuration

Resources