Skip to main content
danti83500242
Participant
June 10, 2015
Question

AIR SDK 17 and ANE problems when packaging app for Android

  • June 10, 2015
  • 2 replies
  • 2345 views

Hi,

I've been facing an issue when trying packaging my application using AIR SDK 17. The error details is below, I have also tried using AIR SDK 15, and AIR SDK 16, but I still get the same error.

Error occurred while packaging the application:

dx tool failed:

UNEXPECTED TOP-LEVEL EXCEPTION:

java.lang.IllegalArgumentException: already added: Landroid/support/v7/appcompat/R$anim;

  at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)

  at com.android.dx.dex.file.DexFile.add(DexFile.java:143)

  at com.android.dx.command.dexer.Main.processClass(Main.java:301)

  at com.android.dx.command.dexer.Main.processFileBytes(Main.java:278)

  at com.android.dx.command.dexer.Main.access$100(Main.java:56)

  at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:229)

  at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)

  at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:130)

  at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:108)

  at com.android.dx.command.dexer.Main.processOne(Main.java:247)

  at com.android.dx.command.dexer.Main.processAllFiles(Main.java:183)

  at com.android.dx.command.dexer.Main.run(Main.java:139)

  at com.android.dx.command.dexer.Main.main(Main.java:120)

  at com.android.dx.command.Main.main(Main.java:89)

1 error; aborting

However, when I change to use < AIR SDK 14, the packaging works just fine. I have also google around this issue, and the reason is duplicate library android-support-v7-appcompat.jar in the ANE. It doesn't make sense to me when I only have 1 ANE in use in my project.

So I tried removing the library android-support-v7-appcompat.jar in the ANE file and repackaging the ANE, now it shows a different error as below screenshot. It looks like android.support.v7.mediarouter relying on android.support.v7.appcompat, so removing android-support-v7-appcompat.jar is not solving the problem.

This is my android-platform.xml

<?xml version="1.0"?>

<platform xmlns="http://ns.adobe.com/air/extension/4.0">

  <packagedDependencies>

  <packagedDependency>android-support-v4.jar</packagedDependency>

  <packagedDependency>google-play-services.jar</packagedDependency>

  <packagedDependency>android-support-v7-appcompat.jar</packagedDependency>

  <packagedDependency>android-support-v7-mediarouter.jar</packagedDependency>

  <packagedDependency>clink210.jar</packagedDependency>

  </packagedDependencies>

  <packagedResources>

  <packagedResource>

  <packageName>com.google.android.gms</packageName>

  <folderName>google-play-services-res</folderName>

  </packagedResource>

  <packagedResource>

  <packageName>android.support.v7.appcompat</packageName>

  <folderName>android-support-v7-appcompat-res</folderName>

  </packagedResource>

  <packagedResource>

  <packageName>android.support.v7.mediarouter</packageName>

  <folderName>android-support-v7-mediarouter-res</folderName>

  </packagedResource>

  </packagedResources>

</platform>

If anyone is facing the same problem, I really appreciate if you would help me figuring out how to resolve this issue.

Regards,

Dan

This topic has been closed for replies.

2 replies

itlancer
Inspiring
June 16, 2015

I have the same problem with including some third party libraries into ANE.

Nimisha1
Participating Frequently
June 17, 2015

Alex and Duc,

To know more about this problem and its solution please read blog post Multiple ANEs and conflicting resources

The entry of same JAR in Runtime.apk and in ANE can cause the same problem.

-Nimisha

Community Manager
June 12, 2015

Hi,

Please let us know which ANE are you using in your application so that we can reproduce this issue at our end.

Regards,

Krati

danti83500242
Participant
June 13, 2015

Hi Krati,

Thank you for getting back to me. Please find the link below for the ANE, I also include the source to build ANE:

https://www.dropbox.com/s/zn7mkohqfd2dd6d/ANE-resources.zip?dl=0

The issue I had described in my previous post happens since AIR SDK 15, I have read its release notes, I guess there would be something to do with the AIR bug fix, please correct me if I'm wrong :

"Android - Auto resolve conflicting common library JARs and common resources for multiple ANEs. ADT will throw warning in case of auto-resolve. (3780590)"

I'm really looking forward to your responses as I have spending 3 days with no luck on fixing it.

Thank you

Community Manager
June 16, 2015

Thanks for reporting the issue.

We are able to reproduce the issue and further investigating it now.

Regards,

Krati