1. <i id='OHLiu'><tr id='OHLiu'><dt id='OHLiu'><q id='OHLiu'><span id='OHLiu'><b id='OHLiu'><form id='OHLiu'><ins id='OHLiu'></ins><ul id='OHLiu'></ul><sub id='OHLiu'></sub></form><legend id='OHLiu'></legend><bdo id='OHLiu'><pre id='OHLiu'><center id='OHLiu'></center></pre></bdo></b><th id='OHLiu'></th></span></q></dt></tr></i><div id='OHLiu'><tfoot id='OHLiu'></tfoot><dl id='OHLiu'><fieldset id='OHLiu'></fieldset></dl></div>

    2. <legend id='OHLiu'><style id='OHLiu'><dir id='OHLiu'><q id='OHLiu'></q></dir></style></legend>

      <tfoot id='OHLiu'></tfoot>

          <bdo id='OHLiu'></bdo><ul id='OHLiu'></ul>
      1. <small id='OHLiu'></small><noframes id='OHLiu'>

        如何让 Powermock 与 Dexmaker 一起工作

        时间:2023-09-25

            <tfoot id='jZ7DL'></tfoot>
              <bdo id='jZ7DL'></bdo><ul id='jZ7DL'></ul>
              <i id='jZ7DL'><tr id='jZ7DL'><dt id='jZ7DL'><q id='jZ7DL'><span id='jZ7DL'><b id='jZ7DL'><form id='jZ7DL'><ins id='jZ7DL'></ins><ul id='jZ7DL'></ul><sub id='jZ7DL'></sub></form><legend id='jZ7DL'></legend><bdo id='jZ7DL'><pre id='jZ7DL'><center id='jZ7DL'></center></pre></bdo></b><th id='jZ7DL'></th></span></q></dt></tr></i><div id='jZ7DL'><tfoot id='jZ7DL'></tfoot><dl id='jZ7DL'><fieldset id='jZ7DL'></fieldset></dl></div>

                <small id='jZ7DL'></small><noframes id='jZ7DL'>

                <legend id='jZ7DL'><style id='jZ7DL'><dir id='jZ7DL'><q id='jZ7DL'></q></dir></style></legend>

                    <tbody id='jZ7DL'></tbody>

                • 本文介绍了如何让 Powermock 与 Dexmaker 一起工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试使用以下版本将 :

                  <块引用>

                  PowerMock 使用自定义类加载器和字节码操作来模拟静态方法、构造函数、最终类和方法、私有方法、删除静态初始化器等等.

                  那个自定义类加载器不太可能在 dalvikvm 上工作.

                  I am trying to incorporate Powermock as a dependency for my Android tests using the following build.gradle configuration:

                  dependencies{
                      compile 'com.android.support:appcompat-v7:21.0.+'
                      androidTestCompile('org.mockito:mockito-core:1.9.5')
                      androidTestCompile('com.google.dexmaker:dexmaker:1.2')
                      androidTestCompile('com.google.dexmaker:dexmaker-mockito:1.2')
                      androidTestCompile('org.powermock:powermock-module-junit4:1.5.5') {
                          exclude module: 'junit'
                      }
                      androidTestCompile('org.powermock:powermock-api-mockito:1.5.5') {
                          exclude module: 'mockito-all'
                      }
                  }
                  

                  However, the compiler is complaining that

                  Error:Gradle: Execution failed for task ':app:packageDebugTest'.
                  > Duplicate files copied in APK mockito-extensions/org.mockito.plugins.MockMaker
                      File 1: ~/.gradle/caches/modules-2/files-2.1/com.google.dexmaker/dexmaker-mockito/1.2/b99884a4c6ef6335ba376f79aa79632b2421c17c/dexmaker-mockito-1.2.jar
                      File 2: ~/.gradle/caches/modules-2/files-2.1/com.google.dexmaker/dexmaker-mockito/1.2/b99884a4c6ef6335ba376f79aa79632b2421c17c/dexmaker-mockito-1.2.jar
                  

                  Looking into the jar structure, I noticed that both Dexmaker and Powermock declare a MockMaker in mockito-extensions

                  What is a MockMaker? How do they differ? And the most important question: Is it possible to get Powermock to work nicely with Dexmaker?

                  Thanks in advance. Any help would be greatly appreciated.

                  解决方案

                  MockMaker is a glue module that integrates dexmaker with Mockito. It does what's necessary for Mockito to generate concrete classes with Dalvik .dex files instead of JVM .class files.

                  It's possible that Powermock will work with Dexmaker, but it's unlikely advanced Powermock features will work. In particular, Powermock advertises this:

                  PowerMock uses a custom classloader and bytecode manipulation to enable mocking of static methods, constructors, final classes and methods, private methods, removal of static initializers and more.

                  That custom class loader is unlikely to work on dalvikvm.

                  这篇关于如何让 Powermock 与 Dexmaker 一起工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何使用 Mockito 和 JUnit 检查方法中的 if 语句? 下一篇:为什么我在使用 PowerMockRunner 运行时不能使用 @

                  相关文章

                  最新文章

                    <i id='PdRdN'><tr id='PdRdN'><dt id='PdRdN'><q id='PdRdN'><span id='PdRdN'><b id='PdRdN'><form id='PdRdN'><ins id='PdRdN'></ins><ul id='PdRdN'></ul><sub id='PdRdN'></sub></form><legend id='PdRdN'></legend><bdo id='PdRdN'><pre id='PdRdN'><center id='PdRdN'></center></pre></bdo></b><th id='PdRdN'></th></span></q></dt></tr></i><div id='PdRdN'><tfoot id='PdRdN'></tfoot><dl id='PdRdN'><fieldset id='PdRdN'></fieldset></dl></div>

                      <bdo id='PdRdN'></bdo><ul id='PdRdN'></ul>

                  1. <tfoot id='PdRdN'></tfoot>

                      <legend id='PdRdN'><style id='PdRdN'><dir id='PdRdN'><q id='PdRdN'></q></dir></style></legend>

                      <small id='PdRdN'></small><noframes id='PdRdN'>