Execution failed for task ':app:transformClassesWithDexForDebug'

plugins

(zhang) #1

Using Asm to inject a class all method

android studio :2.3.1
graldle: 2.14.1

Here is my code :
transform api get all class

def cacheFile = new File(file.parent, file.name + ".cache");
fis = new FileInputStream(file)
fos = new FileOutputStream(cacheFile)
byte[] bytes = hackClass(file, null, false, fis);
fos.write(bytes)

if (file.exists()) {
   file.delete()
 }
cacheFile.renameTo(file)

Asm method visiter

  @Override
  public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    MethodVisitor mv = null;
    if(name.equals("onCreate") || name.equals("onPause")){
        mv = cv.visitMethod(access, name, desc, signature, exceptions);
        return new TraceMethodVisitor(name, mv);
    }
    if (cv != null){
        mv = cv.visitMethod(access, name, desc, signature, exceptions);
    }

    return mv;
}

if MethodVisitor just modify one method, success

modify two or more methods, fail, above code modify two methods

Below is the output from the console:

  :app:transformClassesWithDexForDebug
  Uncaught translation error: com.android.dx.cf.code.SimException:stack: overflow
  Uncaught translation error: com.android.dx.cf.code.SimException:stack: overflow

  2 errors; aborting
  :app:transformClassesWithDexForDebug FAILED

  FAILURE: Build failed with an exception.

  * What went wrong:
 Execution failed for task ':app:transformClassesWithDexForDebug'.
 > com.android.build.api.transform.TransformException: 
 com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: 
 com.android.ide.common.process.ProcessException: Return code 1 for dex process

How can I fix this issue? :frowning:


(liuduotao) #2

the same error with me,do you fix this issue?


(marenbo) #3

same error…guess nobody resolved…


(Ravi) #4

I am getting same error , any one resolved the issue?


(Ravi) #5

Finally resolve the issue by using below command in ionic project folder :

cordova plugin add cordova-plugin-admobpro-firebase