ANDROID ERRORS
2 min readFeb 15, 2022
Gradle sync failed:-
Dont worry do following steps:-
- Goto file → settings → Build,Execution,Deployment
- Click on gradle
- Click on use local gradle distribution
5. Give the path
6. Again click on Build,Execution,Deployment
7. Compiler
8. untick from Configure on Demand
Nothing appearing on layout:-
- Goto res folder in Android IDE
- Click on values
- Click on styles.xml
- replace it with this following code
- <resources> <! — Base application theme. →Base application theme. → <style
name=”AppTheme”
parent=”Base.Theme.AppCompat.Light.DarkActionBar”> <! — Customize your theme here. →Customize your theme here. → <item
name=”colorPrimary”>@color/colorPrimary</item> <item
name=”colorPrimaryDark”>@color/colorPrimaryDark</item> <item
name=”colorAccent”>@color/colorAccent</item> </style> <style
name=”AppTheme.NoActionBar”> <item
name=”coordinatorLayoutStyle”>@style/Widget.Design.CoordinatorLayout</item> <item
name=”windowActionBar”>false</item> <item
name=”windowNoTitle”>true</item> </style> <style
name=”AppTheme.AppBarOverlay”
parent=”ThemeOverlay.AppCompat.Dark.ActionBar”
/> <style
name=”AppTheme.PopupOverlay”
parent=”ThemeOverlay.AppCompat.Light”
/></resources>
- Goto content_main.xml if there some layout does not have content_main.xml than skip this
- replace with relative layout
<?xml version=”1.0" encoding=”utf-8"?><RelativeLayout android:id=”@+id/activity_main” xmlns:android=”http://schemas.android.com/apk/res/android" xmlns:tools=”http://schemas.android.com/tools"android:layout_width="match_parent" android:layout_height=”match_parent” android:paddingLeft=”16dp” android:paddingRight=”16dp” android:paddingTop=”16dp”android:paddingBottom=”16dp” tools:context=”.MainActivity”> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content”android:layout_alignParentTop=”true” android:layout_centerHorizontal=”true” android:layout_marginTop=”242dp” android:text=”Hello World!”
World!” /> <Button android:id=”@+id/button2" android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_alignParentStart=”true”android:layout_alignParentTop=”true” android:layout_marginStart=”78dp” android:layout_marginTop=”151dp” android:text=”Button”
/></RelativeLayout>
- Go to activity_main.xml replace with relative layout
<?xml version=”1.0" encoding=”utf-8"?> version=”1.0"
encoding=”utf-8"?><RelativeLayout
xmlns:android=”http://schemas.android.com/apk/res/android" xmlns:app=”http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools" android:layout_width=”match_parent” android:layout_height=”match_parent” tools:context=”.MainActivity”><android.support.design.widget.AppBarLayout android:layout_width=”match_parent” android:layout_height=”wrap_content”android:theme=”@style/AppTheme.AppBarOverlay”> <android.support.v7.widget.Toolbar android:id=”@+id/toolbar” android:layout_width=”match_parent”android:layout_height=”?attr/actionBarSize” android:background=”?attr/colorPrimary” app:popupTheme=”@style/AppTheme.PopupOverlay”
/> </android.support.design.widget.AppBarLayout> <include
layout=”@layout/content_main”
/> <android.support.design.widget.FloatingActionButton android:id=”@+id/fab” android:layout_width=”wrap_content” android:layout_height=”wrap_content”android:layout_gravity=”bottom|end” android:layout_margin=”@dimen/fab_margin” app:srcCompat=”@android:drawable/ic_dialog_email”
/> <Button android:id=”@+id/button” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:text=”Button”
/></RelativeLayout>