This page describes some of the common issues I faced while developing an Android App. Hope you find it useful.
I am using Android Studio version 1.4.1
- Cannot resolve symbol 'R'
Issue: While getting a handle to a component through its id, I used - R.id.<id> and it was erroring out with the message- 'Cannot resolve symbol 'R'
Solution: Build your project and clean gradle. Click on Build > Clean Project.
- You need to use a Theme.AppCompat theme (or descendant) with the design library
Issue: While selecting an app theme, say, 'Material Light' got the following error-
java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:34)
at android.support.design.widget.AppBarLayout.<init>(AppBarLayout.java:145)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Solution: Remove tools:showIn="@layout/activity_main" in content_main.xml under RelativeLayout tab. If you are having activity_main.xml, try using 'Empty Activity' instead of 'Blank Activity'.
Issue: couldn't resolve resource @dimen/activity_horizontal_margin (4 similar errors not shown)"
" @dimen/activity_horizontal_margin " in attribute "paddingLeft" is not a valid format (4 similar errors not shown)
Solution: Set the values for padding to some dp say 50dp. (dp = density independent pixels)
Issue: Error during Sync: EOF
Solution: Restart your AVD (Android Virtual Device)
- Issue: CPU acceleration status: HAXM must be updated (version 1.1.4 < 6.0.1)
Solution:
- Uninstall Intel HAXM from SDK Manager
- Re-install Intel HAXM
- Go to location- C:\Users\my_user_name\AppData\Local\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager
- Run intelhaxm-android.exe
- Run the emulator
- Issue: android.database.sqlite.sqliteexception no such table <table_name>
Solution: This error occurs when an empty database is created in the application with a specific database version. Increment the DATABASE_VERSION by 1 and run the app.