error


android.support.v7.appcompat

Jika teman-teman memiliki error seperti berikut, mungkin solusi dibawah ini dapat bermanfaat.

01-01 12:15:42.692: E/AndroidRuntime(2176): FATAL EXCEPTION: main
01-01 12:15:42.692: E/AndroidRuntime(2176): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:58)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at com.example.qwerty.MainActivity.onCreate(MainActivity.java:18)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.app.Activity.performCreate(Activity.java:4492)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.os.Handler.dispatchMessage(Handler.java:99)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.os.Looper.loop(Looper.java:137)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at android.app.ActivityThread.main(ActivityThread.java:4424)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at java.lang.reflect.Method.invokeNative(Native Method)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at java.lang.reflect.Method.invoke(Method.java:511)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-01 12:15:42.692: E/AndroidRuntime(2176): 	at dalvik.system.NativeStart.main(Native Method)

Solusi:

  • Import support library sebagai project dari “android_sdk/extras/android/support/v7/appcompat”.
  • Klik kanan pada appcompat_v7 project -> Build Project.
  • Klik kanan pada project yg error -> Properties -> Android -> Scroll kebawah, pada bagian library -> Add… -> Pilih appcompat_v7 -> Ok -> Ok.
  • Build Project.
  • Jika masih error, coba clean kemudian rebuild project.

java.nio.BufferOverflowException

Jika pernah mengalami error seperti dibawah ini ketika compile android menggunakan eclipse.

[2013-11-21 15:31:16 - Test] Dx 
trouble writing output: already prepared
[2013-11-21 15:31:16 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2013-11-21 15:31:16 - Test] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace

Berikut beberapa solusi yang mungkin dapat membantu:

  • Menambahkan¬† support library, caranya: Klik kanan pada project > android tools > android support library.
  • Pastikan android:targetSdkVersion pada AndroidManifest.xml sama dengan target=android-<value> pada project.properties.