Xamarin VS2015 designer not working

2019-01-27 01:16发布

I am working with xamarin for visual studio 2015. For 2 days now the designer of the layout stopped working. It is very difficult to identify the problem cause i don't remember doing anything specific during these days.

Here is a screenshot of the error message Layout error

I have been trying to follow instructions from all over the web, including the xamarin suggestions, without any success.

Here is the detailed text of the exception:

java.lang.NoClassDefFoundError: com/android/utils/ILogger
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: com.android.utils.ILogger
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more
Error: A JNI error has occurred, please check your installation and try again
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0
Exception in thread "main" 

What i already did is: 1. Added the enviromental variable MaxPermSize setting it to different sizes without any success. 2. Reinstalled Java runtime and Java SDK both for x86 and x64. 3. I have only in my system JAVA JRE 8 and SDK 1.8.0_102 x64. 4. Reinstalled the Android SDK tools.

So originally i have the question if there is any workaroung cause i really want to use xamarin but not without the designer?

2条回答
闹够了就滚
2楼-- · 2019-01-27 01:31

It seems that i finally found a solution and would like to share the answer.

Xamarin is a little bit sensitive when it comes the Java JDK version. As found on the website we should have always Java JDK 1.7 but only 32-bit version(even if you're using 64-bit Windows). Here is the link to their page

https://developer.xamarin.com/guides/android/getting_started/installation/windows/manual_installation/

So in my case i tried many solutions and here is what worked:

  1. Uninstall all java and java sdk through the control panel>uninstall programs
  2. Install only java sdk 1.7 32 bit(Java SE Development Kit 7u79) and java 1.7(installed from the sdk installer)
  3. Close Visual Studio
  4. Open Android SDK manager from windows
  5. Delete Android SDK Tools and Android SDK Platform-tools
  6. Install Android SDK Tools and Android SDK Platform-tools
  7. Close Android SDK Manager(the application itself will ask for a restart)
  8. Add the Java_Home and JDK_Home enviromental variables as shown below(I think that Java_Home can be avoided though but haven't tested it yet) enter image description here
  9. Start visual studio. Your layout should load without any problems;

PS: While trying this solution more than 3 times in order to verify it, one time i had to restart my computer.

Hope this is usefull:)

查看更多
神经病院院长
3楼-- · 2019-01-27 01:41

I found a solution, i'm using windows 10 on my machine (64-bit Windows), so instead of downgrading to java JDK 1.7, make sure to install the latest Xamarin updates since updates contains a lot of fixes.

To check for updates follow the link below. Note: check for update more than once till you receive "Xamarin is up to date!"

Go to: Debug > Options enter image description here

https://developer.xamarin.com/recipes/cross-platform/ide/change_updates_channel/#Change_the_Updates_Channel_in_Visual_Studio_2015_and_earlier

查看更多
登录 后发表回答