How to test an Android Library Project

前端 未结 6 2067
一向
一向 2021-01-30 01:28

I am writing an Android Library Project basing on Android Bitmap class (call it AndroindLib) which contains only utility class (no activity). I tried to test it using Android JU

6条回答
  •  北海茫月
    2021-01-30 02:04

    In your test project simply change the package name so that it's the same as your library's package. For example, you have a library whose package is "com.example.lib". Create a test project targeting your library. In the manifest file you'll see package="com.example.lib.test", and targetPackage="com.example.lib". Just change the package from "com.example.lib.test" to "com.example.lib" (targetPackage leave as is).

    Also, make sure that the library is referenced to your test project NOT in Java build path, but as a usual Android library : in Eclipse it must be shown as library in Project->Properties->Android tab, but not in Project->Properties->Java Build Path tab.

    Then run you tests.

提交回复
热议问题