gavinpugh / vs-android

Integrated development of Android NDK C/C++ software with Microsoft Visual Studio.
Other
120 stars 34 forks source link

UNEXPECTED TOP-LEVEL EXCEPTION during sample builds #107

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install vs-android-0.951 files by running "install_vs2012.bat" as 
administrator
2. open any of the sample projects from vs-android_samples in VS2012 
Professional
3. build solution (F7)

What is the expected output? 

BUILD SUCCESSFUL
Total time: 3 seconds
Deploying 
C:\development\vs-android_samples\san-angeles\AndroidApk\bin\DemoActivity-debug.
apk...

What do you see instead?
1>------ Rebuild All started: Project: san-angeles, Configuration: Debug 
Android ------
1>C:\Program Files 
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppBuild.targets(343,5): 
warning MSB8003: Could not find VCInstallDir variable from the registry.  
TargetFrameworkVersion or PlatformToolset may be set to an invalid version 
number.
1>C:\Program Files 
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppBuild.targets(344,5): 
warning MSB8003: Could not find WindowsSDKDir variable from the registry.  
TargetFrameworkVersion or PlatformToolset may be set to an invalid version 
number.
1>  app-android.c
1>  demo.c
1>  importgl.c
1>  san-angeles.vcxproj -> 
C:\development\vs-android_samples\san-angeles\Android\Debug\san-angeles.so
1>  Envvar: JAVA_HOME is set to 'C:\Program Files (x86)\Java\jdk1.7.0_45'
1>  Envvar: JAVA_OPTS is set to ''
1>  c:\apache-ant-1.9.2\bin\ant.bat  debug
1>  Buildfile: 
C:\development\vs-android_samples\san-angeles\AndroidApk\build.xml
1>  
1>  -set-mode-check:
1>  
1>  -set-debug-files:
1>  
1>  -check-env:
1>   [checkenv] Android SDK Tools Revision 22.3.0
1>   [checkenv] Installed at c:\Android\android-sdk
1>  
1>  -setup:
1>       [echo] Project Name: DemoActivity
1>    [gettype] Project Type: Application
1>  
1>  -set-debug-mode:
1>  
1>  -debug-obfuscation-check:
1>  
1>  -pre-build:
1>  
1>  -build-setup:
1>  [getbuildtools] Using latest Build Tools: 19.0.0
1>       [echo] Resolving Build Target for DemoActivity...
1>  [gettarget] Project Target:   Android 2.2
1>  [gettarget] API level:        8
1>       [echo] ----------
1>       [echo] Creating output directories if needed...
1>      [mkdir] Created dir: 
C:\development\vs-android_samples\san-angeles\AndroidApk\bin\rsObj
1>      [mkdir] Created dir: 
C:\development\vs-android_samples\san-angeles\AndroidApk\bin\rsLibs
1>       [echo] ----------
1>       [echo] Resolving Dependencies for DemoActivity...
1>  [dependency] Library dependencies:
1>  [dependency] No Libraries
1>  [dependency] 
1>  [dependency] ------------------
1>  [dependency] API<=15: Adding annotations.jar to the classpath.
1>       [echo] ----------
1>       [echo] Building Libraries with 'debug'...
1>     [subant] No sub-builds to iterate on
1>  
1>  -code-gen:
1>  [mergemanifest] Found Deleted Target File
1>  [mergemanifest] Merging AndroidManifest files into one.
1>  [mergemanifest] Manifest merger disabled. Using project manifest only.
1>       [echo] Handling aidl files...
1>       [aidl] No AIDL files to compile.
1>       [echo] ----------
1>       [echo] Handling RenderScript files...
1>       [echo] ----------
1>       [echo] Handling Resources...
1>       [aapt] Found Deleted Target File
1>       [aapt] Generating resource IDs...
1>       [echo] ----------
1>       [echo] Handling BuildConfig class...
1>  [buildconfig] Generating BuildConfig class.
1>  
1>  -pre-compile:
1>  
1>  -compile:
1>      [javac] Compiling 2 source files to 
C:\development\vs-android_samples\san-angeles\AndroidApk\bin\classes
1>  
1>  -post-compile:
1>  
1>  -obfuscate:
1>  
1>  -dex:
1>        [dex] input: 
C:\development\vs-android_samples\san-angeles\AndroidApk\bin\classes
1>        [dex] input: c:\Android\android-sdk\tools\support\annotations.jar
1>        [dex] Using Pre-Dexed 
annotations-44ba1ac4a255cf8bfc0ab637fb769399.jar <- 
c:\Android\android-sdk\tools\support\annotations.jar
1>        [dex] Converting compiled files and external libraries into 
C:\development\vs-android_samples\san-angeles\AndroidApk\bin\classes.dex...
1>         [dx] 
1>         [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
1>         [dx] java.nio.BufferOverflowException
1>         [dx]     at java.nio.Buffer.nextPutIndex(Buffer.java:519)
1>         [dx]     at java.nio.HeapByteBuffer.putShort(HeapByteBuffer.java:315)
1>         [dx]     at com.android.dex.Dex$Section.writeShort(Dex.java:818)
1>         [dx]     at com.android.dex.Dex$Section.writeTypeList(Dex.java:870)
1>         [dx]     at com.android.dx.merge.DexMerger$3.write(DexMerger.java:437)
1>         [dx]     at com.android.dx.merge.DexMerger$3.write(DexMerger.java:423)
1>         [dx]     at 
com.android.dx.merge.DexMerger$IdMerger.mergeUnsorted(DexMerger.java:317)
1>         [dx]     at 
com.android.dx.merge.DexMerger.mergeTypeLists(DexMerger.java:423)
1>         [dx]     at 
com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:163)
1>         [dx]     at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
1>         [dx]     at 
com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
1>         [dx]     at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
1>         [dx]     at com.android.dx.command.dexer.Main.run(Main.java:230)
1>         [dx]     at com.android.dx.command.dexer.Main.main(Main.java:199)
1>         [dx]     at com.android.dx.command.Main.main(Main.java:103)
1>  
1>  BUILD FAILED
1>  c:\Android\android-sdk\tools\ant\build.xml:892: The following error 
occurred while executing this line:
1>  c:\Android\android-sdk\tools\ant\build.xml:894: The following error 
occurred while executing this line:
1>  c:\Android\android-sdk\tools\ant\build.xml:906: The following error 
occurred while executing this line:
1>  c:\Android\android-sdk\tools\ant\build.xml:284: null returned: 2
1>  
1>  Total time: 2 seconds
1>C:\Program Files 
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Android\Microsoft.Cpp.Android.Ta
rgets(234,5): error MSB6006: "c:\apache-ant-1.9.2\bin\ant.bat" exited with code 
1.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

What version of the product are you using? On what operating system?

Visual Studio: 2012 Professional
Platform Toolset: ARM 4.6 Toolchain(arm-linux-androideabi-4.6)
Target Android API Level: 9
Target Architecture: ARM Achicecture v7-a(armv7-a)
vs-android: 0.951
android-ndk: r9b

Please provide any additional information below.

Original issue reported on code.google.com by JoeCH...@gmail.com on 19 Nov 2013 at 1:56

GoogleCodeExporter commented 9 years ago
I found the problem here. Nothing to do with vs-android. Apparently with Build 
Tools 19.0.0, all API levels must match which I hadn't been paying attention to 
since this never affected any of my Eclipse projects (not entirely sure why 
that is).

Original comment by JoeCH...@gmail.com on 20 Nov 2013 at 11:56

GoogleCodeExporter commented 9 years ago
   I have the same problem with it,and I use visual studio 2010,the error is java.nio.BufferOverflowException too.
   But I don't know how to solved this problem, Which API levels I need change to match it?How to set it?Can anyone give more information ? thanks!

Original comment by masker...@gmail.com on 2 Dec 2013 at 10:29

GoogleCodeExporter commented 9 years ago
But change "target=android-8" to "target=android-19" in project.properties, I 
fix this issue. But I don't know How to keep target to "android-8" and avoid 
this problem.

Original comment by masker...@gmail.com on 3 Dec 2013 at 4:10

GoogleCodeExporter commented 9 years ago
Thanks! I've added a section about this to the Troubleshooting wiki.

Original comment by gavin.dj.pugh on 3 Jan 2014 at 6:19

GoogleCodeExporter commented 9 years ago
Hi. I have followed the procedure mention in installation guide. But still I am 
getting Error MSB6006: "C:\apache-ant-1.9.2\bin\ant.bat" exited with code 
1.  C:\Program 
Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Android\Microsoft.Cpp.Android.Targets
. I tried every possible solution. But still not able to build it. I am using 
VS 2010 

Original comment by jayeshag...@gmail.com on 13 Mar 2015 at 1:00