androidandroid-gradle-pluginandroid-maven-plugin

Is it possible to use the Android-framework in a Java-module?


I am new to Android development. I have the question if and how it is possible to use Android-framework code, like e.g. USBManager in a Java-module in Android-Studio. Or do I have to convert it to something else to do the trick? Cheers David

As I am currently not able to use imports like android.v7.etc..


Solution

  • I have found the answer in the android documentation. Java-modules are not meant to use the Android-framework. You must use an Android-library for that (There's also an option to create a Java Library, which builds a traditional JAR file. While a JAR file is useful for many projects— especially when you want to share code with other platforms—it does not allow you to include Android resources or manifest files, which is very useful for code reuse in Android projects. So this guide focuses on creating Android libraries. https://developer.android.com/studio/projects/android-library) Cheers David