1

I downloaded idea version 13 community edition for android development. I downloaded JDK 1.7 and Android SDK. When I was creating android project I specified jdk version and android sdk version. So, here is a problem: when I choose jdk 1.7 and android sdk 4.0.3 or less when I push "Rebuild project" I have this error log:

Android Dex: [testApp2] Unable to execute DX
Android Dex: [testApp2] java.nio.BufferOverflowException
Android Dex: [testApp2] at java.nio.Buffer.nextPutIndex(Buffer.java:519)
Android Dex: [testApp2] at java.nio.HeapByteBuffer.putShort(HeapByteBuffer.java:315)
Android Dex: [testApp2] at com.android.dex.Dex$Section.writeShort(Dex.java:818)
Android Dex: [testApp2] at com.android.dex.Dex$Section.writeTypeList(Dex.java:870)
...

Here is my manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.example.testApp2"
          android:versionCode="1"
          android:versionName="1.0">

    <uses-sdk android:minSdkVersion="8"
              android:targetSdkVersion="16"/>

    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
        <activity android:name="MainActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>
konunger
  • 186
  • 3
  • 14

2 Answers2

2

I got the same problem last days, too. I can solved it, with an update of the Android Build tools to Version 18.1.1. Version 19.0 doesn't work for me.

To up-/downgrade it in Intellij go to the Android ADK-Manager (Tools->Android->SDK-Manager) Under Tools are the diffrent Android SDK Build-tools. Install version 18.1.1. Maybe uninstall version 19.

This works for me.

BHuelse
  • 2,889
  • 3
  • 30
  • 41
1

This looks to be a bug in the build tools. The answer to this question suggests that you need to ensure that android:targetSdkVersion in your AndroidManifest.xml must match the target.sdk property in local.properties.

In your situation you have specified;

<uses-sdk android:targetSdkVersion="16"/>

So in your local.properties it should be set to;

target.sdk=android-16

Shouldn't be any need to downgrade the build tools version.

Community
  • 1
  • 1
marcus.ramsden
  • 2,633
  • 1
  • 22
  • 33