4

When I add ONE SHARE SDK as dependency I get the following error message:

Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'. com.android.build.api.transform.TransformException: org.gradle.tooling.BuildException: com.android.dx.cf.iface.ParseException: class name (com/sina/weibo/sdk/component/view/CommentComponentView$RequestParam) does not match path (weiboSDKCore_3.1.2/com/sina/weibo/sdk/component/view/CommentComponentView$RequestParam.class)

What could be the cause of this error?

ankuranurag2
  • 2,300
  • 15
  • 30
不爱读书
  • 41
  • 1
  • 1
  • 3

3 Answers3

3

Adding the following code to build.gradle app module solved my problem

android{
    defaultConfig {

        // Enabling multidex support.
        multiDexEnabled true
    }


    dexOptions {
        javaMaxHeapSize "4g"
    }
}
dependencies {
    //...
    compile 'com.android.support:multidex:1.0.0'
}

Source Code

Naveen Tamrakar
  • 3,349
  • 1
  • 19
  • 28
0

Sounds like the error is recognizing a class cast issue. It expects CommentComponentView$RequestParam.class

but it getting something else. Could be different version or duplicate named class where it is trying to figure out which one to use and it is using the wrong one.

For example if I have a class called

public class MyClass {

}

and the SDK has a class called

public class MyClass {

}

then in the usage it could be confusing the two. Check your import statements to make sure you are using the correct path and version of the parameter that it is expecting as maybe it is a duplicate class that is confusing it by accessing the wrong version of that class.

This may not be your issue, but worth checking out. Goodluck.

Sam
  • 5,342
  • 1
  • 23
  • 39
  • 1
    Awesome glad to help. If it solved your issue, can you mark the answer so others can find this topic answered as well. – Sam Oct 02 '17 at 15:28
0

It's probably a rare scenario, but I had it. Previously, an android-support-v4.jar file was manually added to my project. This was done before the use of the gradle. Remove the file and the build was successful.

pier_nasos
  • 668
  • 4
  • 17