Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to create release build after updating play services to 8.3.0

Unable to create Release APK after updating play services to version 8.1.0 or 8.3.0 I am getting following exceptions.

Anyone have any idea how to fix this.

Uncaught translation error: com.android.dx.cf.code.SimException: com.android.dx.rop.cst.CstMethodRef cannot be cast to com.android.dx.rop.cst.CstInterfaceMethodRef
Uncaught translation error: com.android.dx.cf.code.SimException: com.android.dx.rop.cst.CstMethodRef cannot be cast to com.android.dx.rop.cst.CstInterfaceMethodRef
2 errors; aborting
Error:Execution failed for task ':project:dexRelease'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 1
like image 449
alphanso Avatar asked Nov 16 '15 11:11

alphanso


2 Answers

Please see this Android issue.

It's a known bug. The official workaround is:

The development team has fixed the issue that you have reported and it will be available in a future build.

Workaround for time being: Right the issue is that you need to put the useLibrary element if you need to compile against it. But if you don't compile your code against it but you have 3rd party libs that use it and you run through proguard (Which is picky about wanting to see all the classes that are used), then we need to pass it to proguard whether you ask for it for compiling or not.

The short term work-around is to ask for the library for compiling (which will then also add it to the classpath that we give to proguard).

It basically means you should either recompile all libraries (including third-party libraries) with the latest Google Play Services or revert to an older Google Play Services version.

like image 192
Codo Avatar answered Oct 21 '22 00:10

Codo


I run into the same error message. In my case it was related to Retrolambda.

I wasn't using any third-party libraries that depend on Google Play Services, so Codos answer was useful but didn't solve the problem for me.

It turned out that a static factory method on an interface caused this issue:

public interface Foo {
  static Foo get() {
    ...
  }
}

Removing the static method from the interface and doing a clean/rebuild solved the problem for me.

According to the documentation there are known issues with static interface methods: Retrolambda Known limitations

like image 33
micha Avatar answered Oct 20 '22 22:10

micha