java.lang.NoClassDefFoundError: com/android/utils/ILogger into visual studio 2015 - java

I've a Xamarin Android app running on Visual Studio 2015. Since a few days I'm no longer able to edit XML layout files into Android Designer getting the following error:
java.lang.NoClassDefFoundError: com/android/utils/ILogger
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
at java.lang.Class.getMethod0(Class.java:2774)
at java.lang.Class.getMethod(Class.java:1663)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: com.android.utils.ILogger
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
Exception in thread "main"
I've already tried to update JAVA (to jdk 1.8) and setting it, update Xamarin to the lastest version and installed almost all missing Android SDK versions and tools.
Any idea on how to fix it to come back to edit & visualize Android xml/axml layout activities?

In my case it was fixed by removing the Preview Channel Packages and install the previous version packages.
Open Android SDK Manager and delete "Tools (Preview Channel) > Android SDK Tools". Install previous version Android SDK Platform Tools (in my case Rev 23.1)

Related

ClassNotFoundException for FileOpUtils with Android Studio 2.0 Preview

After upgrading to Android Studio 2.0 Preview I see the following exception when I try to build a project
Error:Internal error: (java.lang.ClassNotFoundException) com.android.repository.io.FileOpUtils
java.lang.ClassNotFoundException: com.android.repository.io.FileOpUtils
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.android.sdklib.repository.local.LocalSdk.<init>(LocalSdk.java:182)
at com.android.sdklib.repository.local.LocalSdk.<init>(LocalSdk.java:191)
at org.jetbrains.jps.android.AndroidBuildDataCache.getSdk(AndroidBuildDataCache.java:145)
at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidTarget(AndroidJpsUtil.java:403)
at org.jetbrains.jps.android.AndroidJpsUtil.getAndroidPlatform(AndroidJpsUtil.java:478)
at org.jetbrains.jps.android.builder.AndroidPreDexBuildTarget.computeRootDescriptors(AndroidPreDexBuildTarget.java:110)
at org.jetbrains.jps.builders.impl.BuildRootIndexImpl.addRoots(BuildRootIndexImpl.java:72)
at org.jetbrains.jps.builders.impl.BuildRootIndexImpl.<init>(BuildRootIndexImpl.java:62)
at org.jetbrains.jps.cmdline.BuildRunner.load(BuildRunner.java:83)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:266)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:232)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:42)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
It is a known issue but any comments there are "me too".
Has anyone been able to workaround this?
Update
This issue has been resolved in 2.0 Preview 4.
A workaround was posted in a comment to the issue filed.
On my Mac I performed the following steps in a Terminal:
vi /Applications/Android\ Studio.app/Contents/plugins/android/lib/android.jar
Select META-INF/plugin.xml for editing.
Add ;repository.jar to the classpath attribute in the line <compileServer.plugin classpath="sdklib.jar;common.jar;jarutils.jar;layoutlib-api.jar;manifest-merger.jar"/> and save changes.
Open Android Studio
As mentioned in the comment you may need to apply this workaround again after further updates to Android Studio if the issue still hasn't been resolved.
Warning
After applying the above changes Android Studio is no longer able to apply patch updates. You get a warning like that shown in this question. It seems the only solution is a re-install. According to the comments on the issue though the problem still exists in the latest build.

Raspberry pi - java - Serial Com

I've got a serious problem with my Raspberry Pi (OS: Raspbian) and Java (JDK-7-Armhf). My code wont execute without creating a Exception.
I'll been reading and trying several proposals and nothing have worked yet.
So now i am confused of what went wrong..?
So it goes like this:
I've got a Java source code that will run in my Eclipes IDE.
But when i export the .jar-file, even with library (JRE System lib. _86, JavaSE1.7, JAVAX.comm), as "Runnabel JAR" or just .JAR and execute it om my Raspberry pi, i've got "NoCLassDefFoundExecption: SerialPortEventListener..!
I just don't know why, it won't find the library and use it..!
On my Pi i have librxtx-java installed and JDK-7-oracle-armhf.
librxtx-java should be setting its JAVA_PATH on it's own when installed, but not sure that is done correct!
(I've got a folder /usr/jni and it contains: librxtxSerial.so and
/usr/lib/jvm/jdk-7-oracle-armhf/).
Looking at the library Javax.RXTXcomm in Eclipse, i've got RXTXcomm.jar, that contains SerialPortEventListener, so it is defininated i the .jar.
I'm thinking about, could it be, that there is a missing link between my Java JVM and linux serialport driver? My JRE is working in some way, because it will execute a code to readout HOSTNAME & IP-Adress.
So is there some one who knows how to fix this..?
This is a readout of Java Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/SerialPortEventListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Caused by: java.lang.ClassNotFoundException: javax.comm.SerialPortEventListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
A copy of my code. "SimpleRead.java" The original from java comm API samples
You have to change the reference from javax.comm to gnu.io in your source code.
Try following:
Switch to root and run the program you created
If that helps do following
sudo adduser username dialout
then log out and log in from all terminals and GUIs

Getting this error in eclipse editor

I am getting this error in eclispe editor all of a sudden It was working previously. I am using Mac OSx
I was not getting that before. I am building the project using ant which is working fine. I am using Eclipse 4.3.2. Is it specific to MAC OS ? I am also cobertura to generate reports. Also when I run a groovy test case I am getting this
java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/HasBeenInstrumented
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2436)
at java.lang.Class.getDeclaredFields(Class.java:1806)
at org.spockframework.runtime.SpecInfoBuilder.buildFields(SpecInfoBuilder.java:86)
at org.spockframework.runtime.SpecInfoBuilder.doBuild(SpecInfoBuilder.java:57)
at org.spockframework.runtime.SpecInfoBuilder.build(SpecInfoBuilder.java:42)
at org.spockframework.runtime.Sputnik.getSpec(Sputnik.java:78)
at org.spockframework.runtime.Sputnik.runExtensionsIfNecessary(Sputnik.java:86)
at org.spockframework.runtime.Sputnik.getDescription(Sputnik.java:55)
at org.junit.runner.Runner.testCount(Runner.java:41)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.countTestCases(JUnit4TestClassReference.java:30)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.countTests(RemoteTestRunner.java:487)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:455)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.cobertura.coveragedata.HasBeenInstrumented
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 28 more
Thanks in advance for your Help.
Cobertura was pretty much dead project a year ago. Latest Java version it could handle was JDK6. So your problems can be caused by newer version of Java.
There was some development done lately, but my concerns are:
It is not clear (from Cobertura current website) with what versions of Java it can cooperate
Which is the official Maven bundle
How can I get latest version. Obviously not from github.
So we switched to different coverage tool called JaCoCo. It can handle Java7 coverage (not sure about Java8 so far). If you want nice plugin in Eclipse, go to Help -> Eclipse Marketplace... -> Type "EclEmma" into Find bar -> Go. This plugin is using JaCoCo under the hood.
EDIT
After posting your versions of Java and Cobertura, my suspects become true. Your version of Cobertura works only with Java6. Thy to update Cobertura version somehow, or switch to above suggested alternative.

To use Android Studio encountered an error

I have Android Studio (Google I/O Preview).
I created an android project in Android Studio, and when I run it, the Studio tell me :
/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -ea -Didea.launcher.port=7534 -Didea.launcher.bin.path=/home/username/android-studio/bin -Dfile.encoding=UTF-8 -classpath /home/username/android-studio/lib/idea_rt.jar:/home/username/android-studio/plugins/junit/lib/junit-rt.jar:/home/username/android-studio/sdk/platforms/android-17/android.jar:/home/username/android-studio/sdk/platforms/android-17/data/res:/home/username/android-studio/sdk/tools/support/annotations.jar:/home/username/AndroidStudioProjects/test/test/libs/android-support-v4.jar com.intellij.rt.execution.application.AppMain com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 #/tmp/idea_junit6666593680737984739.tmp -socket52225
Exception in thread "main" java.lang.NoClassDefFoundError: junit/textui/ResultPrinter
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113)
Caused by: java.lang.ClassNotFoundException: junit.textui.ResultPrinter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 3 more
Process finished with exit code 1
What can I try?I've Googled this but haven't had much luck.
I don't know.When I use the Windows Version, I didn't meet any error;
Sounds like to me from your windows version has the missing class while your Linux Version does not.
Caused by: java.lang.ClassNotFoundException: junit.textui.ResultPrinter
Make sure you have this class in your library or where ever you are calling it for.
Hope this helps or points you to the right direction.

Exception in thread "main" java.lang.NoClassDefFoundError in Java3D

I'm trying to develop a java3d application, i try everything, i just download the jogamp-platform because how i could read in many websites the java3d is obsolete and for mac os x you need this, i put them all in /System/Frameworks/Java/Extensions where are my .jar files in order to not add to the classpath in Eclipse but it still getting the same error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/AbstractGraphicsDevice
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at javax.media.j3d.Pipeline$1.run(Pipeline.java:143)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:138)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:926)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:280)
at javax.media.j3d.Canvas3D.<clinit>(Canvas3D.java:3862)
at Apartado_a.<init>(Apartado_a.java:17)
at Apartado_a.main(Apartado_a.java:67)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.AbstractGraphicsDevice
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 10 more
These are the files inside extensions folder:
j3daudio.jar
j3dcore.jar
j3dutils.jar
joal-natives-macosx-universal.jar
jogl-all.jar
gluegen-rt.jar
gluegen-rt-natives-macosx-universal.jar
Regards!
Mac OS X comes pre-installed with Java 3D version 1.3. You can find these files in /System/Library/Java/Extensions. If you need to install Java 3D version 1.5 (and it sounds like you do), then you can use this installer: http://create.ife.no/vr/tools/j3d/java3d_1_5_2-macosx.pkg.zip
Don't use the /System/Frameworks/Java/Extensions folder for this.
Instead, include the relevant libraries in the lib/ folder of your application. Also, check which version of the JDK you are using. I believe there are some issues with Java3D running on the newer Apple-provided JVMs versus the older Oracle/Sun provided ones.

Categories

Resources