Android Studio - UNEXPECTED TOP LEVEL EXCEPTION - android

I can't figure out what I'm doing wrong, or have done wrong to debug my app. Can anyone give me an idea of how to fix this?
I deleted all the libraries and reinstalled them, and I've worked out that it's an issue with the Google Repository. But I don't know what to do. Any ideas would be great.
Thanks
Error:Execution failed for task ':SecuriHUB:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Program Files (x86)\Android\android-studio1\sdk\build-tools\android-4.4W\dx.bat --dex --num-threads=4 --output C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\dex\debug C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\classes\debug C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\dependency-cache\debug C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\avcodec-a23ce361a09c930e68fee244ef4b9f70b8df1da4.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\avcodec-bab13459b97dce683c98960d6342d99522af142f.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\avutil-52522a8339be7c888d2262803acf07db17ec6aa2.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\avutil-6a389e589f441392b5746bb77bf970e260c15ac8.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-2b5def6b4c7c7ce682519b9b0443fe04a26c0919.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-2f5552383b37e78f4ec718f853bc1b1e1ec317a2.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-42b726da5c048a82a08e89a4b70c184b94608aa0.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-6e01a35945fee3c0661a964108bc1f436ada1652.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-76fa51ae23d8bf77e8657dce65fcc7cf5b61044d.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-96196602ae75c43f247b5c746cd935d656b8b543.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-9b73bafe39f49c24dfc02321659c168a6d30c9b9.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-cae5aaa06f449bff8bee4372de96fa33783e31ee.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-ee9ef6ddaaef0705b573495d987a8ea074f0bc0a.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\classes-fe7b9a83f65f77ec6904839666546d97f8c5c435.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\commons-io-1.3.2-76b40519b6d96123e0fafc55a0437071960ae683.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\commons-io-1.3.2-e23cc4dead7a42abc070337b6602255ca7a78ff3.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\GSSc-3ac0bc0f497991728bf7e0dc89da2dc1425604d1.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\GSSc-577c0e7d97895f2804faa5f54f1999124502db90.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\httpclientandroidlib-1.1.2-2caa8f5d76aec2bd9d92323cc8b178d8d67f6081.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\httpclientandroidlib-1.1.2-ec8f9ce27a72b4bf5d7cf1b5784c45f09b73caa0.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\internal_impl-20.0.0-45e7f39ff8ef841d2b829e696be46453d466481b.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\internal_impl-20.0.0-565a411117f2b6f68963042a0d52ec0b2b843b4d.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\json-1.0.0-0722a5a7126e9051d1bd542a6af3e6bc94116d50.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\json-1.0.0-2f404cb0d63823de6ac84000bf670564809870b7.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\redmine-java-api-1.23.1-25bdd461e5cb7eb722db4cdfb2f55f44c1df1fe6.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\redmine-java-api-1.23.1-e491ee895bc5f5e09d8af0b4db6f552cda256ca5.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\slf4j-api-1.7.1-2329e6fbcf26dbe6aed9bd7c2820b4ceaae23de6.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\slf4j-api-1.7.1-b7cd7d60262580384ff9b076e0244ef18212f212.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\support-annotations-20.0.0-1514e8d1e5d6b1f7784080d9e0002766205e8fd5.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\support-annotations-20.0.0-d005872198788c93ef85f437377c5a4608557980.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\swscale-d2110a412161ef1a3b43b811bf48cb6ca2a64c61.jar C:\Mezzo\Koren\mezzo\SecuriHUB\build\intermediates\pre-dexed\debug\swscale-e5534023e6b3b892096f3ad4fd09226e3317701d.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/BuildConfig;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)

I have no idea how I fixed this, but I did.
I had to reinstall the sdk and the libraries again, and make sure that in the build.gradle it had minimum sdk of 11 or something.
But hey, who am I to complain... IT WORKS NOW WOO!

Related

Android Libraries "Revert System Files to Default" after Delphi v10.2.2 to v10.2.3 upgrade broke compliation

After upgrading Delphi from v10.2.2 to v10.2.3, the TBannerAd banner raised exception when trying to call the LoadAd method.
After understanding that "Tokyo 10.2.3 has updated Google Play Services and its libraries." (Google AdMob TBannerAd LoadAd exception after upgrading to Delphi v10.2.3), I tried the suggested fix of "Reverting System Files to Default" by right-clicking the Android Libraries node in the Project manager.
However, doing so broke compilation, returning this error:
[Exec Error] The command "PATH {my entire path} & "C:\Users\MyUser\Documents\Embarcadero\Studio\19.0\PlatformSDKs\android-sdk-windows\build-tools\27.0.2\dx.bat" --dex --output="Z:\Tic\Android\Debug\classes.dex" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\android-support-v4.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\cloud-messaging.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\fmx.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-analytics-v2.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-billing.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-licensing.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-ads-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-analytics-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-base-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-identity-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-maps-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-panorama-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-plus-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services-wallet-7.0.0.dex.jar" "c:\program files (x86)\embarcadero\studio\19.0\lib\Android\Debug\google-play-services.dex.jar" " exited with code 2.
I manually entered the command and this is the full error message:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:506)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:336)
at com.android.dx.command.dexer.Main.runDx(Main.java:291)
at com.android.dx.command.dexer.Main.main(Main.java:247)
at com.android.dx.command.Main.main(Main.java:94)
The Android SDK listed under the project manager is v24.3.3 32bit.
Did I miss updating something on the Android side?
I got an answer on the original thread that resolves this, it seems that using the "Reverting System Files to Default" option still left the old "google-play-services.dex.jar" service.
To fix the issue, I right-clicked the entry and selected "Disable", closed Delphi, opened my project's ".dproj" file in a text editor, searched for "DisabledSysJars" and removed the problematic entry.

com.android.dex.DexException: Multiple dex files define while ant build

I know that there are a lot of posts about this exception but non of them seemed to be helpful. I have deleted all the bin and gen folders, i have removed all library dependencies and added them again but this issue still remains.
This is the exception I get:
[dex] Pre-Dexing /home/me/dev/Workspaces/FacebookSDK/libs/android-support-v4.jar -> android-support-v4-40c394661b7676703ffc1366ddef840c.jar
[dex] Converting compiled files and external libraries into /home/me/dev/Workspaces/MyApp/bin/classes.dex...
[dx]
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define Lcom/my/app/Manifest$permission;
[dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:593)
[dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:551)
[dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:532)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:169)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:230)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:199)
[dx] at com.android.dx.command.Main.main(Main.java:103)
[dx]
could be something with the manifest merger?
didn't find anything unusual in my manifests files (app and libraries etc..)
App compiles and works when built and launched from eclipse.
Any ideas?
Thanks!
Consider showing your AndroidManifest.xml and build.gradle files here.
This problem is mainly because you are trying to compile two modules (mainly app and library) with same package-name for your app.
Try to change your package-name for a while, to see if that's the case.
Also this problem has been seen when libraries are added more than one time accidently. Try to see how you're compiling the libraries.

Error building Player: CommandInvokationFailure: Unity3d

i have just a blank project with prime31 google play game services plugin in it and im trying to run the demo scene and i keep getting this error, i feel like its something simple like setting environment variables or something, any help is greatly appreciated thank you
Error building Player: CommandInvokationFailure: Unable to convert
classes into dex format. See the Console for details. C:Program Files
(x86)Javajdk1.7.0_51binjava.exe -Xmx1024M
-Dcom.android.sdkmanager.toolsdir="C:/Users/John P. Rowan III/android-sdkstools" -Dfile.encoding=UTF8 -jar "C:/Program Files
(x86)/Unity/Editor/Data/BuildTargetTools/AndroidPlayersdktools.jar" -
stderr[
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic
(00051607) or version (0000.0002) at
com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at
com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at
com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at
com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:665) at
com.android.dx.command.dexer.Main.processFileBytes(Main.java:634) at
com.android.dx.command.dexer.Main.access$600(Main.java:78) at
com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572) 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:596) at
com.android.dx.command.dexer.Main.processAllFiles(Main.java:498) at
com.android.dx.command.dexer.Main.runMonoDex(Main.java:264) at
com.android.dx.command.dexer.Main.run(Main.java:230) at
com.android.dx.command.dexer.Main.main(Main.java:199) at
com.android.dx.command.Main.main(Main.java:103) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 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) ...while parsing
__MACOSX/com/google/android/gms/ads/._a.class
1 error; aborting
Interesting as for environment variables, no, that will only help you find files that are missing, in this case we have a parsing error in your plugin.
There are multiple things you can try to resolve it, one weird thing i notice in the log was the path to java: C:Program Files (x86)Javajdk1.7.0_51binjava.exe There are no dashes "\" in the path, might be wrong but that might be neeeded.
Secondly, if you open the project in eclipse and try to compile it from there, if it still gets you error's you might want to contact prime31 for support, since this is a parsing error in the code, which you can see from the log.
"UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dx.cf.iface.ParseException: bad class file magic " means that there are lines or characters in places that do not belong there.

adding 'emma' to Android ant build triggers "local variable type mismatch" exception

I am trying to run Emma on the tests for an Android project that is a combination of Java and C/JNI code. The build and tests work fine, but whenever I add emma, I get a mysterious exception. I'm using the Android SDK v20.1 and NDK r8b.
The project is here, its an Android library project:
https://github.com/guardianproject/IOCipher
and the tests are here:
https://github.com/guardianproject/IOCipherTests
The build.xml file is generated using android update test-project. Running ant clean debug install test works everytime while ant clean emma debug install test triggers the exception:
here's the exception:
-dex:
[dex] Converting compiled files and external libraries into /var/lib/jenkins/workspace/IOCipherTests/IOCipherTests/bin/classes.dex...
[dx]
[dx] EXCEPTION FROM SIMULATION:
[dx] local variable type mismatch: attempt to set or access a value of type int using a local variable of type info.guardianproject.libcore.io.ErrnoException. This is symptomatic of .class transformation tools that ignore local variable information.
[dx]
[dx] ...at bytecode offset 0000002e
[dx] locals[0000]: Linfo/guardianproject/iocipher/File;
[dx] locals[0001]: Linfo/guardianproject/iocipher/FileDescriptor;
[dx] locals[0002]: <invalid>
[dx] locals[0003]: <invalid>
[dx] locals[0004]: <invalid>
[dx] locals[0005]: [Z
[dx] stack[top0]: int{0x00000001 / 1}
[dx] ...while working on block 002c
[dx] ...while working on method createNewFile:()Z
[dx] ...while processing createNewFile ()Z
[dx] ...while processing info/guardianproject/iocipher/File.class
[dx]
[dx] 1 error; aborting
BUILD FAILED
/opt/android-sdk/tools/ant/build.xml:850: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:852: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:864: The following error occurred while executing this line:
/opt/android-sdk/tools/ant/build.xml:266: null returned: 1
I was getting the same error. In my project we had a unit test app in one project, which wrapped another project containing the unit tests themselves. Both projects held references to my SDK which, as chaitanya suggested, was causing emma to instrument the SDK code twice. By removing the reference to the SDK in the unit test project I was able to resolve the error.
I build the Android APK project from the command line (without ant, but with some help of CMake. I guess this is not important here) and I met the same error, two things helped me:
From here, I got the info that "If you instrument class files that have local variable debug information in them emma does not correctly maintain the local variable table. This will cause an error when you try to convert the class files for Android. The workaround for this to compile the java classes with only line and source debug information, not local information.", so I add a flag to java compiler-g:{lines,source}
I also excluded Emma classes itself from instrumentation. My instrumentation command is java -cp emma/emma_device.jar emma instr -ix -*.test.*,-com.google.android.*,-com.vladium.* -m overwrite -cp ${CMAKE_JAVA_TARGET_OUTPUT_DIR}. Pay attention to -ix -com.vladium.* parameter, this excludes Emma classes

Failed to build Android app (refer to both ActionBarSherlock & ViewPagerTabs) with Ant

I have one Android app which uses ActionBarSherlock & ViewPagerTabs. I use Eclipse to write and build it, and it just works well until I try to build it with Ant. Here's what I did:
go to ActionBarSherlock folder, run "android update lib-project --path ."
go to ViewPagerTabs folder, run "android update lib-project --path ." too
go to app folder, run "android update project --path ."
run "and debug" under app folder, and I got following errors:
:
[javac] C:\Android\TestApp\src\com\test\App\TestActivity.java:46: cannot find symbol
[javac] symbol : method getSupportActionBar()
[javac] location: class com.test.App.TestActivity
[javac] final ActionBar ab = getSupportActionBar();
[javac] ^
So question NO. 1: I have correct library references in app's project.properties, and ActionBarSherlock & ViewPagerTabs could be built successfully, why do I still get these errors?
There's a workaround for this issue -- copy all classes.jar under library's bin folder into app's libs folder, and run "ant debug" again. But I need to delete these .jar files under app's libs folder after all .java files of app could be compiled.
Running "ant debug" again after this, I will get following errors:
[dx] processing archive C:\Android\ActionBarSherlock\library\bin\classes.jar...
[dx] ignored resource META-INF/MANIFEST.MF
[dx] processing android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoStubImpl.class...
[dx] processing android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.class...
[dx] processing android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat.class...
[dx] processing android/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs.class...
[dx] processing android/support/v4/app/ActionBar$LayoutParams.class...
[dx] processing android/support/v4/app/ActionBar$OnMenuVisibilityListener.class...
[dx] processing android/support/v4/app/ActionBar$OnNavigationListener.class...
[dx] processing android/support/v4/app/ActionBar$Tab.class...
[dx] processing android/support/v4/app/ActionBar$TabListener.class...
[dx] processing android/support/v4/app/ActionBar.class...
[dx] processing android/support/v4/app/ActivityCompatHoneycomb.class...
[dx]
[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActivityCompatHoneycomb;
[dx] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[dx] at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
[dx] at com.android.dx.command.dexer.Main.processClass(Main.java:486)
[dx] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:455)
[dx] at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[dx] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:394)
[dx] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[dx] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[dx] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[dx] at com.android.dx.command.dexer.Main.processOne(Main.java:418)
[dx] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:329)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:206)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:174)
[dx] at com.android.dx.command.Main.main(Main.java:95)
[dx] 1 error; aborting
My question NO.2 is: how can I fix this issue?
Thanks!
I finally resolve it myself. I find that there's a android-support-v4.jar in ViewPagerTabs' libs folder. The solution is -- deleting this android-support-v4.jar, then make ViewPagerTabs depend on ActionBarSherlock (because ActionBarSherlock actually have one copy of Support Package).
I hope it's useful for people who wants to use ActionBarSherlock & ViewPagerTabs in one application and use Ant to built his/her application. Good luck.
You stated its because both library have android-support-v4.jar. See #porter-liu answer for non-maven builds.
For people using maven, set your ViewPager dependancy as:
<dependency>
<groupId>com.viewpagerindicator</groupId>
<artifactId>library</artifactId>
<version>2.4.1</version>
<type>apklib</type>
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
</exclusion>
</exclusions>
</dependency>
The exclusion tag stops the double import fixing the issue.
When you update lib-project, you're updating the project so that it compiles as a library. There's a separate step to update your main project so that it sees the library it requires.
For each library project you're going to use, run
android update project --library ../pathToTheLibrary

Categories

Resources