Trouble importing .class files into Android project

[亡魂溺海] 提交于 2019-12-11 23:40:20

问题


Hello Stack Overflow community,

I'm creating an Android app for an engineering project. The basic goal of the app is to remotely control an RC car via WiFi. The car has a camera and microphone mounted on it, and transmits video and voice wirelessly back to the control. We (the group) have a working Java app where the video transmission works perfectly via a wireless camera. I have the working Java code, but the code requires for .class files to function: aplug.class, aplug$AU.class, aplug$SI.class, and aplug$TS.class. In Eclipse, to get the program working I had to "Add External Class Library" to get the code to compile, and everything works fine. However, I can't seem to get past the declaration declaration line:

private aplug applet = new aplug();

I've tried "Add External Class Folder", and "Add Class Folder" in Eclipse, as well as "Configure Build Path", and right-clicking the classes -> "Add to Build Path", but nothing seems to work. I also tried

<uses-library>android:name="aplug.class" />

in the AndroidManifest.xml file. Does anybody know how to import these .class files so I can use them in my Android Project?

Thanks in advance!


回答1:


Step #1: Package them as a JAR.

Step #2: Put the JAR in your libs/ directory.

Step #3: Choose Add JAR in the build path in Eclipse and add the reference to the JAR.



来源:https://stackoverflow.com/questions/5667832/trouble-importing-class-files-into-android-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!