We normally face errors while development of application. Some are common mistakes which we frequently make. Here we list down the error faced while development of Application with reason and resolution adopted in removing the errors
Error | Unable to open class file R.java. or R.id. text01 is marked as red even after compilation. |
Possible Reason |
|
Resolution. | Clean the Project . Select Project → Clean. |
Error | Null Pointer Error |
Possible Reason |
Example: public class CartActivity extends Activity { TextView lblusername; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_cart); // lblusername = (TextView) findViewById(R.id.usernamelbl); lblusername.setVisibility(View.GONE); As per the example above following may be the reason. |
Resolution. | Uncomment // lblusername = (TextView) findViewById(R.id.usernamelbl); Or lblusername = (TextView) findViewById(R.id.usernamelbl); statement is missing and should be added. |
Error | ActivityNotFoundException error. |
Possible Reason | Due to some reason an entry in Android manifest is missing. |
Resolution. | Add and entry in Android Manifest file as mentioned below. <activity android:name=".ComplaintActivity" android:label="@string/title_activity_complaint" > </activity> |
Error | OutofMemoryError error. |
Possible Reason | This error may occur mainly due to using bit map, gallery , etc. When a request for memory is made that can not be satisfied using the available platform resources. |
Resolution. |
bitmap.compress(Bitmap.CompressFormat.PNG,100,outstream); |
Error | Toast is written properly but nothing is displayed |
Possible Reason | Show() method is missing. |
Resolution. | Add the .show() method to show the Toast and see if it is working well. |
Error | Permission Errors. |
Possible Reason | to AndroidManifest file. Especially while using Internet services,email, google map, read write to SD Card or SMS service. |
Resolution. | <manifest xlmns:android...> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name= "android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name= "android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name= "android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name= "com.example.towntour.permission.MAPS_RECEIVE" /> <uses-permission android:name= "android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name= "android.permission.CALL_PHONE" /> <uses-permission android:name= "android.permission.READ_PHONE_STATE" /> <uses-permission android:name= "com.google.android.providers.gsf.permission.READ_GSERVICES" /> </manifest> |
Error | appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable' |
Possible Reason | When using the v7-appcompat in Eclipse we have to use it as a library project. It isn't enough to just copy the *.jar to your /libs folder As soon as the project is imported, some folders in the /res folder are red-underlined/crossed. |
Resolution. | Follow the following steps. 1. Open the project.properties file of the android-support-v7-appcompat and change the target from target=android-19 to target=android-21. 2. Project –> Clean and see the changes take effect. |