huh? can't find parent for StyleData in Android Studio

627 views
Skip to first unread message

Mary-Anne Cosgrove

unread,
Feb 17, 2014, 6:24:12 AM2/17/14
to robol...@googlegroups.com
I'm trying to run Robolectric tests with the Android Studio project structure. I have a separate module for my Robolectric tests as I am also running instrument tests which now live in the main project.
I've set up org.robolectric.Config.properties to point Robolectric to my AndroidManifest in the main project. That's working fine.

But when I try to create my Activity I get this:

WARNING: no system properties value for ro.build.date.utc
DEBUG: Loading resources for com.thoughtworks.androidbootcamp from ./../AndroidBootcamp/src/main/res...

java.lang.RuntimeException: huh? can't find parent for StyleData{name='AppTheme', parent='Theme_AppCompat_Light_DarkActionBar'}
at org.robolectric.shadows.ShadowAssetManager$StyleResolver.getParent(ShadowAssetManager.java:351)
at org.robolectric.shadows.ShadowAssetManager$StyleResolver.getAttrValue(ShadowAssetManager.java:336)
at org.robolectric.shadows.ShadowResources.findAttributeValue(ShadowResources.java:293)
at org.robolectric.shadows.ShadowResources.attrsToTypedArray(ShadowResources.java:196)
at org.robolectric.shadows.ShadowResources.access$000(ShadowResources.java:55)
...

I'm using the 2.3-SNAPSHOT

Any suggestions?

Mike Grafton

unread,
Feb 19, 2014, 10:25:24 AM2/19/14
to robol...@googlegroups.com
Mary-Anne,

Are you using Gradle? Maven? Or neither?

Over here at Pivotal we are looking at seamless integration of Gradle and Studio for Robolectric happiness. I don't know about bundling instrumentation tests in there as well, though. I'll ask around today.

Mike


--
You received this message because you are subscribed to the Google Groups "Robolectric" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robolectric...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Mary-Anne Cosgrove

unread,
Feb 19, 2014, 5:56:35 PM2/19/14
to robol...@googlegroups.com
I'm using Gradle with Novoda's gradle-android-test-plugin. I've written up what I've done to get it working so far here
Currently I'm able to run the Robolectric tests within Android Studio, including debugging, UNTIL I try to create an Activity. Everything else seems to be working fine.

I've been wracking my brain on this for weeks now. I'd really appreciate your help.

Thanks

Mike Grafton

unread,
Feb 21, 2014, 8:56:11 PM2/21/14
to robol...@googlegroups.com
Thanks for the info. Like I said, we're dedicating some resources right now to gradle and studio support. If you could post this as a GitHub issue, it will be the best way of tracking this particular problem.

Mike

Mary-Anne Cosgrove

unread,
Feb 22, 2014, 1:20:22 AM2/22/14
to robol...@googlegroups.com
Thanks Mike. I've created issue #979.


--
You received this message because you are subscribed to a topic in the Google Groups "Robolectric" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/robolectric/D5JRpW6GJLc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to robolectric...@googlegroups.com.

Nico Küchler

unread,
Feb 25, 2014, 3:49:45 PM2/25/14
to robol...@googlegroups.com
Hey Mary, this sounds like something thats also happen to me. It was another style, but you use the actionbarsherlock library?

When yes, you should have a folder called unpacked-bundles in your build folder. There is the missing stuff ;)
So look that you have 2 files "project.properties" and "test-project.properties" next to your AndroidManifest.xml. And type into test-project.properties file the relative pathes to your folder inside unpacked-bundles. After that you should get multiple messages from "DEBUG: Loading resources ..."

Example thats works for me, AndroidManifest is located in src/main/
android.library.reference.1=../../build/unpacked-bundles/LibFolderName1
android.library.reference.2=../../build/unpacked-bundles/LibFolderName2

More informations: http://robolectric.org/apklibs/  (Working with ApkLibs)

Mary-Anne Cosgrove

unread,
Mar 1, 2014, 11:13:36 PM3/1/14
to robol...@googlegroups.com
Thanks Nico.

I've tried your suggestion but I keep getting the same error.

I've tried:
```android.library.reference.1=../AndroidBootcamp/build/exploded-bundles/ComAndroidSupportAppcompatV71901.aar/res```
```android.library.reference.1=../AndroidBootcamp/build/exploded-bundles/ComAndroidSupportAppcompatV71901.aar```
```android.library.reference.1=./AndroidBootcamp/build/exploded-bundles/ComAndroidSupportAppcompatV71901.aar/res```
and
```android.library.reference.1=./AndroidBootcamp/build/exploded-bundles/ComAndroidSupportAppcompatV71901.aar```

With the same result each time.


Any more suggestions?


--

Nico Küchler

unread,
Mar 2, 2014, 4:37:46 AM3/2/14
to robol...@googlegroups.com
Hey Mary, 

without knowing how is your project structure i'm not sure wether you tried the correct paths.
From your first post i know already someing like this:

project
- - AndroidBootcamp
- - - - build/build/exploded-bundles/ComAndroidSupportAppcompatV71901.aar
- - RobolectricTests

Where is your AndroidManifest.xml located?
Where are your poject.properties and test-project.properties located?

When: 
AndroidBootcamp/src/main/AndroidManifest.xml
Then:
AndroidBootcamp/src/main/test-project.properties with android.library.reference.1=../../build/exploded-bundles/ComAndroidSupportAppcompatV71901.aar

When:
AndroidBootcamp/AndroidManifest.xml
Then shoud it be (not tested):
AndroidBootcamp/test-project.properties with android.library.reference.1=build/exploded-bundles/ComAndroidSupportAppcompatV71901.aar

When the setup is successful (will not imply your error must be gone) your will get not only:

WARNING: no system properties value for ro.build.date.utc
DEBUG: Loading resources for com.thoughtworks.androidbootcamp from ./../AndroidBootcamp/src/main/res...

instead there should be an additional message like:
DEBUG: Loading resources for android.support.v7.appcompat from ./../AndroidBootcamp/src/main/../../build/exploded-bundles/ComAndroidSupportAppcompatV71901.aar/res...

i hope this will fix your problem
Reply all
Reply to author
Forward
0 new messages