0

My android studio messed up everything. App is working fine. There's no error in compiling and installing app. When I open files in notepad++ there's everything is perfect.

I've tried so far clean Project, Rebuild, Invalidate Cache and Restart. Even I created a new project and copied all the files and assets. Still same problem. Let see the screenshot

Screenshot of HomeActivity.xml

But the actual code in HomeActivity is

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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=".HomeActivity">
    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_marginBottom="?attr/actionBarSize">
        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/fab"
            style="@style/floating_action_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/fab_margin"
            android:backgroundTint="@color/colorPrimary"
            android:clickable="true"
            android:src="@drawable/ic_add_plus"
            app:borderWidth="0dp"
            app:elevation="6dp"
            app:rippleColor="@color/colorGreyLight" />
    </FrameLayout>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <include
            android:id="@+id/app_bar"
            layout="@layout/home_app_bar" />
        <androidx.viewpager.widget.ViewPager
            android:id="@+id/view_pager"
            android:layout_width="match_parent"
            android:layout_height="160dp"
            android:layout_below="@id/app_bar"
            android:layout_alignParentTop="false"
            android:layout_margin="8dp" />
        <LinearLayout
            android:id="@+id/slider_dots"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/view_pager"
            android:gravity="center_horizontal|center_vertical"
            android:orientation="horizontal"></LinearLayout>
        <com.google.android.material.bottomnavigation.BottomNavigationView
            android:id="@+id/bottom_navigation"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="?android:attr/windowBackground"
            app:labelVisibilityMode="labeled"
            app:menu="@menu/bottom_nav_menu" />
    </RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

Here is my build.gradle file if you need.

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"
    defaultConfig {
        applicationId "com.apnaapp"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.android.support:appcompat-v7:29.+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:29.+'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

Any suggestions are most appreciated. Let me know if you require any details regarding.

smac89
  • 39,374
  • 15
  • 132
  • 179
  • You could make a copy of your project in a different location and uninstall/reinstall Android Studio again. – Ajeeli May 05 '20 at 20:55
  • @Ajeeli Sir, it requires me a lot data. And I've a slow internet connection in my town. Can you please suggest me anything else – Abdul Qadir May 05 '20 at 21:03
  • Delete all files in C:\Users\Your.username\.AndroidStudio\system\caches, but make a copy of your project first. – Ajeeli May 05 '20 at 21:28
  • This looks like an encoding issue. Run the command `file --mime-encoding ` (replace the last part with the actual path to your file) to get the encoding of the file, then verify that android studio is using this same encoding when reading the file – smac89 May 06 '20 at 03:59
  • 1
    Another option is to invalidate cache and restart android studio. **File > Invalidate Caches/Restart > Invalidate and Restart** – smac89 May 06 '20 at 04:05
  • Tried everything, Thank anyway, I'm reinstalling android studio. It might works. Let see – Abdul Qadir May 06 '20 at 08:13

0 Answers0