无法使用Visual Studio 2015编辑Xamarin的.axml布局文件。

huangapple go评论97阅读模式
英文:

Can't edit Xamarin .axml layout files with Visual Studio 2015

问题

由于工作中的版本许可限制,我不得不使用Visual Studio 2015开发Xamarin Android应用程序。我必须说,在个人电脑上使用Visual Studio 2019(学生版本)一切正常,但我不能在工作中使用该许可证进行开发。

在我的工作电脑上,我已经安装并更新了适用于Visual Studio 2015的Xamarin扩展,并使用了Java Runtime Environment v1.8.0_241和Java Development Kit v1.8.0_231,正如我在许多指南中所阅读的一样,这是我的配置:

无法使用Visual Studio 2015编辑Xamarin的.axml布局文件。

我创建了一个空的Xamarin Android项目,除了空项目包含的文件外,没有任何我修改过的代码。但是,当我尝试打开.axml文件时,会出现以下错误:

“连接到布局渲染器失败。这可能是由于Java配置不正确引起的。”

以下是完整的错误报告:

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:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 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
Picked up _JAVA_OPTIONS: -XX:MaxPermSize=256m
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Exception in thread "main"

关于“忽略选项MaxPermSize=256m”的最后一行是由于我按照指南创建的一个环境变量导致的,但现在我已经没有其他选择了 :/

我在质疑是否可以使用Visual Studio 2015开发Xamarin,或者我是否必须要求老板升级许可证。

我非常感谢任何支持。谢谢。

英文:

Due to a version license restriction at work, I have to develop a Xamarin Android app using Visual Studio 2015. I must say that using Visual Studio 2019 (Student version) on my personal computer everything works fine, but I can't develop with that license at work.

On my work computer, I have installed and updated the Xamarin for Visual Studio 2015 extension, and using Java Runtime Environment v1.8.0_241 and Java Development Kit v1.8.0_231, as I read at so many guides, here my config:

无法使用Visual Studio 2015编辑Xamarin的.axml布局文件。

I have created and empty Xamarin Android Project, with no more files than the empty project includes, and there is no code modified by my side. But I get this error when trying to open the .axml file.

"Connection to the layout renderer failed. This may be caused by a misconfiguration of Java."

Here the full error report:

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:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 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
Picked up _JAVA_OPTIONS: -XX:MaxPermSize=256m
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Exception in thread "main" 

Last line about "ignoring option MaxPermSize=256m" is due to a environment variable I created following guides, but now I have run out of options :/

I'm questioning if it is even possible to develop with Xamarin using Visual Studio 2015 or I have to ask my boss to upgrade license.

I appreciate any support. Thanks.

答案1

得分: 0

我遇到过的唯一解决方案是:

我在使用Android Studio编辑.xml文件(UI设计),然后将代码复制到Visual Studio 2015的.axml文件中,现在它可以工作。我的应用程序非常简单,我只有Button、TextView和EditText,对我来说已经足够了。

如果你有一个更具可扩展性的解决方案,避免使用外部工具(Android Studio),我支持你。

英文:

The only solution I have encountered as far:

I'm editing the .xml files (the UI designs) using Android Studio, then copy the code to the .axml in Visual Studio 2015, and now it works. My application is very simple, I only have Button, TextView and EditText, and it is enought for me.

If you have a more scalable solution, avoiding to use an external tool (Android Studio) my vote is yours.

huangapple
  • 本文由 发表于 2020年4月6日 18:49:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/61058077.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定