How to create class files in Android Studio

2019-08-15 17:45发布

So I'm needing to create class files in Android Studio so I can use URLClassLoader. I need to do this so that I can pass custom objects through a socket, I keep getting a ClassNotFoundException. I know the conventional way to go about this is to add the object's class to the classpath, but I couldn't figure that out - things I read online seemed to either be outdated, or for a different setup.

I can't see how to create class files, though. When I build an IntelliJ object, the class files get created. But not in AndroidStudio. Why?

2条回答
Deceive 欺骗
2楼-- · 2019-08-15 17:59

If your AS is setup correctly then creating the classes should appear in the AS path. Do you have some more context on the setup of your project so that we can advice further?

查看更多
一夜七次
3楼-- · 2019-08-15 18:05

Java classes can be created by right-clicking on a Java folder then New > Java Class

A Java folder can be created by right-clicking another folder and selecting New > Folder > Java Folder

The compiled Java class file will be found by going to the module's folder then build > intermediates > classes > debug > company.name > com > app.name

查看更多
登录 后发表回答