Search Unity

everyplay pluging conflics with unity project

Discussion in 'Android' started by ahmedandre, Apr 24, 2015.

  1. ahmedandre

    ahmedandre

    Joined:
    Jul 26, 2014
    Posts:
    20
    I'm getting the following exception and I don't know how to debug it, that's while building the game using Unity3D game engine.

    When I import everyplay there is a resource folder in the Android Project, it seems it conflicts with my R$.class, so from my game there is an R.Class and also there is one that is generated from the resources folder of the Android project and I get a dex error, as following....



    BuildPipeline.BuildPlayer failed, error=Error building Player:CommandInvokationFailure:Unable to convert classes into dex format.See the Consolefor details.
    C:\Program Files\Java\jdk1.7.0_51\bin\java.exe -Xmx1024M-Dcom.android.sdkmanager.toolsdir="C:/Program Files (x86)/android-sdk\tools"-Dfile.encoding=UTF8 -jar "C:/Program Files (x86)/Unity4.5/Editor/Data/BuildTargetTools/AndroidPlayer\sdktools.jar"-

    stderr[

    UNEXPECTED TOP-LEVEL EXCEPTION:
    java.lang.IllegalArgumentException: already added:Lcom/asgatech/app/R$attr;
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
    at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
    at com.android.dx.command.dexer.Main.processClass(Main.java:732)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
    at com.android.dx.command.dexer.Main.access$300(Main.java:83)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
    at com.android.dx.command.dexer.Main.processOne(Main.java:632)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
    at com.android.dx.command.dexer.Main.run(Main.java:246)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at SDKMain.main(SDKMain.java:129)1 error; aborting
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    The build process (specifically, the DEX tool) is complaining that the same class was added twice.
    The class is this : Lcom/asgatech/app/R$attr;

    Are you sure you are not adding this class twice somehow (e.g: including the same sources twice, for example)
     
  3. ahmedandre

    ahmedandre

    Joined:
    Jul 26, 2014
    Posts:
    20


    @liortoal,
    Thanks for your response. The problem that the Everyplay unity plugin, in the Android plugin, there is .jar and there are resource folders, and manifest. maybe it generates r$attr.class too, but how can I prevent that.. If I remove the plugin directory, and just keep it's jar, the everyplay can't identify that there is support for android platform, but in that case the build works..
    everyplay unity plugin, on android platform there are folders of res, manifest,..etc.. how can I prevent them from not generating R$class too ?
     
  4. ahmedandre

    ahmedandre

    Joined:
    Jul 26, 2014
    Posts:
    20
    here is the folder of the sdk
     

    Attached Files:

  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Every Android library usually places its code under a different package to avoid these collisions.
    I would doubt that the generated R class from Everyplay gets mixed with other code.

    What other Java stuff do you have in your project? Could you list the entire output of Assets/Plugins/Android ?
     
  6. ahmedandre

    ahmedandre

    Joined:
    Jul 26, 2014
    Posts:
    20
    the entire plugins folder just have the everyplay plugin, now I figured out another problem, build fails not only with everyplay, but with any other plugins like Unity Ads.
     
  7. ev3d

    ev3d

    Joined:
    Apr 19, 2013
    Posts:
    327
    resolution?
     
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Are you also facing this issue @ev3d ?