question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dexcache == null error

See original GitHub issue

This issue from the old google code project: https://code.google.com/p/dexmaker/issues/detail?id=2 is still valid as of the released 1.2 version

Java.lang.IllegalArgumentException: dexcache == null (and no default could be found; consider setting the 'dexmaker.dexcache' system property)
at com.google.dexmaker.DexMaker.generateAndLoad(DexMaker.java:359)
at com.google.dexmaker.stock.ProxyBuilder.buildProxyClass(ProxyBuilder.java:252)
at com.google.dexmaker.mockito.DexmakerMockMaker.createMock(DexmakerMockMaker.java:51)
at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:41)
...

However, I verified that it has been fixed in the current github repository (last commit March 12th 2015 - ca74669):

  • git clone https://github.com/crittercism/dexmaker.git
  • cd dexmaker
  • mvn install -Dmaven.test.skip=true
  • cp -R ~/.m2/repository/com/google/dexmaker $ANDROID_HOME/extras/android/m2repository/com/google
  • and then update project dependency to 1.3-SNAPSHOT

It would be nice to have a 1.3 release so that we can take the workaround lines out of the test setUp() methods: System.setProperty(“dexmaker.dexcache”, getContext().getCacheDir().getPath());

Thanks!

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
vaughandroidcommented, Sep 10, 2015

@mjohenneken Thanks! Adding the dexmaker-dx dependency worked for me. 👍

2reactions
AnthonyUccellocommented, May 13, 2016

Hey guys I found a workaround for this that works:

https://comadeblog.wordpress.com/2013/11/12/dexcachenull-for-mockito-on-robolectric/comment-page-1/

Basically use 1.9 version of Mockito:

compile 'org.mockito:mockito-core:1.9.0'

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - dexcache == null error - - Bountysource
This issue from the old google code project: https://code.google.com/p/dexmaker/issues/detail?id=2 is still valid as of the released 1.2 ...
Read more >
android - Robolectric = Mockito : Cannot Create Mock or Spy ...
I just found this workaround: https://comadeblog.wordpress.com/2013/11/12/dexcachenull-for-mockito-on-robolectric/comment-page-1/. TL;DR:.
Read more >
dexmaker - issue #2 - Google Code
Code should work but i get an error: java.lang.IllegalArgumentException: dexcache == null (and no default could be found; consider setting ...
Read more >
Mockito & Android How-To - Kevin Schultz
... I have to hunt down the solution to the 'dexcache == null' error. ... simply setting the System property as specified in...
Read more >
libart/src/main/java/java/lang/Class.java - platform/libcore
this will be String[][]). null for non-array classes. */. private transient Class<?> componentType;. /**. * DexCache of resolved constant pool entries.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found