简体   繁体   English

罐子和包装无法使用

[英]jar and package won't work

I'm building a small game application. 我正在构建一个小型游戏应用程序。 I've build the whole engine using java and seperated the engine from the logic, and it worked perfectly fine as a console and a swing-UI application. 我已经使用Java构建了整个引擎,并将该引擎与逻辑分离,并且它作为控制台和swing-UI应用程序运行良好。

now I want to migrate it into android and for some reason my emulator crashes each time I try to create any instance from the package I've build. 现在,我想将其迁移到android中,由于某种原因,每次尝试从已构建的包中创建任何实例时,模拟器都会崩溃。

I added it to the project as a jar file (and added it to my path). 我将其作为jar文件添加到项目中(并将其添加到我的路径中)。 afterwards I added the *.java package to the android project and it still crashes. 之后,我将* .java包添加到android项目中,但仍然崩溃。

your help would be much appreciated. 您的帮助将不胜感激。

There may be a million reasons for this. 可能有上百万个原因。 Most likely reasons are: 最可能的原因是:

  • You compile your code to Java 7 (you have different class format) 您将代码编译为Java 7(具有不同的类格式)
  • You use a dependency that is not present in the Android environment 您使用了Android环境中不存在的依赖项

Try to add your source to the source folder of your Android project, and let the Android environment compile it to you. 尝试将您的源代码添加到Android项目的源文件夹中,然后让Android环境将其编译为您。 Do not use the jar file. 不要使用jar文件。 That will work for sure. 那肯定会起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM