问题:
The official JDK and the Android runtimes are fairly similar but support different sets of classes. For example, the java.awt package is unavailable on Android, and the and...
可以将文章内容翻译成中文,广告屏蔽插件会导致该功能失效:
问题:
The official JDK and the Android runtimes are fairly similar but support different sets of classes. For example, the java.awt
package is unavailable on Android, and the android
packages are unavailable in the JDK.
In order to write a Java library that functions in both regular Java and Android, it would be desirable to run the JUnit tests inside both VMs. Is there a way to do this, such as using a Maven plugin? Or is there a different approach that's recommended?
回答1:
Unit tests executed on an Android device/emulator - or "Instrumented Unit Tests" as they are called can be developed using Android Studio / Gradle.
I am not sure if and how Instrumented Unit Tests can be performed directly with Maven.
One possible way would be to execute Gradle from within Maven using gradle-maven-plugin.