mercredi 28 octobre 2015

Android Unit tests using library resources fail when run from command line

SUMMARY:

Two modules, android application module and an android library module. Unit test for Application module calls static method on class from Library module that returns resource id of resource defined in Library. Unit test fails on this call with "Caused by: java.lang.ClassNotFoundException: com.example.librarybase.R$string", but only when run from command line (gradlew test). Unit tests pass when run from Android Studio.

SET UP:

Gradle version 2.4
Android Plugin Version 1.4.0-beta6 (repro also on 1.3.0)
SDK Version: “Android SDK Tools” Rev. 24.4.1
Compile Sdk Version 23
Build Tools Version 23.0.1

Android Studio 1.5 Preview 2
Build #AI-141.2343905, built on October 15, 2015
JRE: 1.7.0_79-b15 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation

Windows 7 Professional 64-bit (6.1, Build 7601)

WORKAROUND:

http://ift.tt/1KF0Sh4

MORE INFO:

http://ift.tt/1O7dUf0 http://ift.tt/1KF0Qpi

Aucun commentaire:

Enregistrer un commentaire