I am running on command-line only. I have tried the various fixes suggested by different stackoverflow answers (adding the Android support library, setting project.properties
to use 18.1.1
, but none of them seem to fix the problem. I have tried with both version 19
and version 18.1.1
of the platform-tools
.
Here is the output of android list targets
Available Android targets:
----------
id: 1 or "android-8"
Name: Android 2.2
Type: Platform
API level: 8
Revision: 3
Skins: WQVGA432, QVGA, WVGA854, WQVGA400, WVGA800 (default), HVGA
ABIs : armeabi
----------
id: 2 or "Google Inc.:Google APIs:8"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 2
Description: Android + Google APIs
Based on Android 2.2 (API level 8)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WQVGA400, WVGA854, HVGA, WQVGA432, WVGA800 (default), QVGA
ABIs : armeabi
----------
id: 3 or "android-19"
Name: Android 4.4
Type: Platform
API level: 19
Revision: 1
Skins: WQVGA432, QVGA, WVGA854, WXGA720, WSVGA, WXGA800, WQVGA400, WVGA800 (default), HVGA, WXGA800-7in
ABIs : armeabi-v7a
----------
id: 4 or "Google Inc.:Google APIs:19"
Name: Google APIs
Type: Add-On
Vendor: Google Inc.
Revision: 1
Description: Android + Google APIs
Based on Android 4.4 (API level 19)
Libraries:
* com.google.android.media.effects (effects.jar)
Collection of video effects
* com.android.future.usb.accessory (usb.jar)
API for USB Accessories
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: WQVGA400, WVGA854, WSVGA, WXGA800-7in, WXGA720, HVGA, WQVGA432, WVGA800 (default), QVGA, WXGA800
ABIs : armeabi-v7a
Here is the command I am using the create the project:
android create project \
--target 1 \
--name Foo \
--path Foo \
--activity Foo \
--package com.Foo
When I cd
into the directory, and use ant build
, I immediately get the BufferOverflowException
described in the other questions:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:519)
at java.nio.HeapByteBuffer.putShort(HeapByteBuffer.java:315)
at com.android.dex.Dex$Section.writeShort(Dex.java:818)
at com.android.dex.Dex$Section.writeTypeList(Dex.java:870)
Note that, I also ran adb -verbose debug
, and the actual command that breaks is this (directories removed):
│'<android_home>/build-tools/19.0.0/dx'
│with arguments:
│ [dx] '--dex'
│ [dx] '--output'
│ [dx] '/<path>/Foo/bin/classes.dex'
│ [dx] '/<path>/Foo/bin/classes'
│ [dx] '/<path>/Foo/bin/dexedLibs/annotations-064aab7f6d582a07d494f
│b587176a0bd.jar'