0

I am building a HelloWorld-project called 'HelloGlass' using the GDK.

I have a HelloGlassActivity class, which works perfectly fine when launched and compiled. I then try adding another class, HelloGlassService, which extends android.app.Service and implements one abstract function. The moment I add this class, the project suddenly stops compiling with and throws the following error:

Android Dex: [HelloGlass] Unable to execute DX Android Dex: [HelloGlass] java.nio.BufferOverflowException Android Dex: [HelloGlass] at java.nio.Buffer.nextPutIndex(Buffer.java:499)

Now, Google and StackOverflow tell me that this error can be resolved by making sure that the AndroidManifest SDK version matches the one my project is dependent on. However, all my dependencies are JDK 1.6 and the GDK Sneak Peek.

As in Google's own Stopwatch example, my project does not include a project.properties file (I removed it after creating the default Android app template provided by IntelliJ and setting it to the GDK Sneak Peek SDK); and that's what my AndroidManifest.xml looks like:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.arik.HelloGlass"
          android:versionCode="2"
          android:versionName="1.0" >

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

    <application
            android:allowBackup="true"
            android:label="Hello Glass App" >

        <activity
                android:name="com.arik.HelloGlass.HelloGlassActivity"
                android:label="Hello Glass Activity"
                android:enabled="true" >
        </activity>

    </application>

</manifest>

As you can see, I did not even include that Service Class in the manifest, and yet it crashes. The Service class looks like this:

package com.arik.HelloGlass;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

public class HelloService extends Service{
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}

And here are my module dependencies:

enter image description here

What am I doing wrong?

arik
  • 28,170
  • 36
  • 100
  • 156
  • possible duplicate of [BufferOverflowException when building application](http://stackoverflow.com/questions/19741758/bufferoverflowexception-when-building-application) – Tony Allevato Jan 27 '14 at 16:40
  • No, I've seen that question, and it didn't solve my problem, for the Android Support Library / GDK Sneak Peek is already included in my module. – arik Jan 27 '14 at 17:13
  • Can you try the suggestions in the other answers (not only the accepted one) about switching from v19 to v18.x of the build tools? – Tony Allevato Jan 27 '14 at 17:32
  • I haven't been using them anyway, but the v15 build tools, as they are the ones required for the GDK Sneak Peek (unless I am mistaken and Module SDK ≠ build tools) – arik Jan 27 '14 at 22:46
  • 1
    The version of the Build Tools is not related to the version of the Android platform. Incidentally, version 19.0.1 (December 2013) of the build tools claim to have "Fixed BufferOverflowException problem in the dx build. (Issue 61710)", so you may want to try that. – Tony Allevato Jan 27 '14 at 23:29
  • Ah, now you say it, I looked it up in my SDK Manager and noticed that I only have build tools version 19 installed, rather than 19.1. I'm currently downloading the update. I hope downloading it will automatically change the build tools in IntelliJ, for I don't actually know how to change them there. – arik Jan 27 '14 at 23:38
  • Followup: Updating to 19.1 did the trick. Thanks! – arik Jan 27 '14 at 23:46
  • You're welcome, glad to hear it worked! – Tony Allevato Jan 28 '14 at 00:25

0 Answers0