When inflating a layout in a Fragment, with the LayoutInflater, i am getting this exception:
./res/layout/locations_list.xml line #-1 (sorry, not yet implem
I figured it out, and if you got stock to such an situation just look for your IDs in the XML, even though
android:id="@+id/android:list"
is often seen in some example code it must be:
android:id="@android:id/list"
In my case I got this problem when I had this in my app:
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>r13</version>
</dependency>
but this in my unittest project:
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>r7</version>
</dependency>
The older version of the support library I used in the tests didn't contain the class I was trying to use (android.support.v4.widget.DrawerLayout).
In my case, my FragmentActivity
XML was inflating a Fragment
that was expecting a Bundle
. I swapped the XML for a FrameLayout
holder and added the fragment with the proper bundle in the activity.
The last version of Robolectric (3.0-Snapshot) has some problems with customized views.
To fix that, do the follow:
android.library.reference.1=../../build/intermediates/exploded-aar/com.etsy.android.grid/library/1.0.5
Here you must check three things:
You have an example of project working here: https://github.com/jiahaoliuliu/RobolectricSample/blob/master/app/src/main/project.properties